1

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

Nathan
  • 1,220
  • 3
  • 15
  • 26
Alex Michael Raj
  • 185
  • 2
  • 9
  • 24

2 Answers2

3

try fully pathing your DB in your url

public final static String connectionURL = 
"jdbc:derby:d:/myproject/projectDB;create=true;user=user1;password=psssword";
Scary Wombat
  • 44,617
  • 6
  • 35
  • 64
0

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.

Manuel
  • 127
  • 2
  • 11