how do i connect to a derby database created in Netbeans externally?
I've created a a Java DB in Netbeans, I can connect to the Java DB server and then to my database from Netbeans. I need to use this database outside of Netbeans... a table from this database is used in a program which i created with netbeans... i open the program using the .jar file outside of netbeans... but i can't access the table.
can anyone help me with this?
what exactly are you wanting to do? to connect to the database i use this
String driverName = "org.apache.derby.jdbc.ClientDriver";
Class.forName(driverName);
String url = "jdbc:derby://localhost:1527/table name";
String username = "username";
String password = "password";
connection = DriverManager.getConnection(url, username, password);
you need to make sure that you have the derbyclient.jar file in the librarie for your project.
Message was edited by:
developprograms
ya, i used similar code to connect to the database in my code...with Netbeans, before running my program, I start the Java DB server from Tools>Java DB Database. Is their any way of starting this server on my computer outside of netbeans?
In embedded mode, starting Derby can be accomplished by loading the driver.Class.forName("org.apache.derby.jdbc.EmbeddedDriver");In a network deployment, you can use the start-up scripts supplied.