سؤال

I use the following code to create db connection

public final static String driver = "org.apache.derby.jdbc.ClientDriver";
public final static String connectionURL = "jdbc:derby:projectDB;create=true;user=user1;password=psssword";

public CreateConnectionDOA(String driver, String connectionURL) throws ClassNotFoundException,SQLException
    {
            Class.forName(driver);
            conn = DriverManager.getConnection(connectionURL);
            conn.setAutoCommit(false);
    }

The project was created in Netbeans-Platform-Application-Module. When i run the project through netbeans platform 7.4.. it works properly.

But when i try to create a installer using netbeans and run.. the project opens but it also gives an exception

"ERROR 42Y07: Schema 'projectDB' does not exist

هل كانت مفيدة؟

المحلول

try fully pathing your DB in your url

public final static String connectionURL = 
"jdbc:derby:d:/myproject/projectDB;create=true;user=user1;password=psssword";

نصائح أخرى

Full path works because your relative path was probably wrong. With a correct relative path, it should work. Keep in mind that current directory is your project directory; write the relative path (../dataBase if necessary works as expected) and it will work.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top