tags:

views:

53

answers:

1

I have a table in a application, which loads in data from a Derby DB with a Client/Server driver. Everything works in NetBeans, even with the NetBeans DB service disconnected, but not when running the standalone distributive app. I have included the derbyclient.jar in the classpath. I have the startNetworkServer.bat in the distributable apps folder(not in /dist), and it is run within the program at initialization. I'm new to Derby, so maybe i'm missing/not including something important?

A: 

First i load the startNetworkServer.bat file:

ProcessBuilder pb = new ProcessBuilder("D:/Users/lapa2/Desktop/Skeneris/InventoryController/dist/startNetworkServer.bat");
p = pb.start();

Which doesn't work, I set that by manually opening cmd line for now.

Then the driver and connection are set:

private static final String jdbcDriver
= "org.apache.derby.jdbc.ClientDriver";


private static final String jdbcURL
    = "jdbc:derby://localhost:1527/D:/Users/lapa2/Desktop/Skeneris/InventoryController/dist/Lapa;create=true;";

Then I query everything i want:

db = new DataBase(userName,password,databaseName);
    String dbStatement = "select * from "+ schemaName + ".PRECES";
    ResultSet rs = db.executeQuery(dbStatement);

Doing like this, everything works in NetBeans, but no response when running the .JAR.

Demonick
For future reference, update your post instead of adding answers to your post.
Romain Hippeau
Specifically what errors are you getting.? Have you looked at http://db.apache.org/derby/papers/DerbyTut/index.html to make sure it is installed properly ?
Romain Hippeau
I get a NonTransientConnectionException, when startNetworkServer.bat is run within the app. When i run it manually from cmd.exe, then it works, and no other errors are present. But even with that, the distributable JAR. file won't run correctly, not getting data from the table.
Demonick
The same happens with the EmbeddedDriver. What could i be missing?
Demonick