Reputation: 1159
I'm getting the following error (Note: I am using Netbeans):
java.sql.SQLException: No suitable driver found for jdbc:derby://localhost:7001/LF_JHU_DERBY
at java.sql.DriverManager.getConnection(DriverManager.java:596)
at java.sql.DriverManager.getConnection(DriverManager.java:215)
at randomtests.UFTest.main(UFTest.java:38)
The relevant part of my code is:
Class.forName("org.apache.derby.jdbc.EmbeddedDriver");
DriverManager.getConnection("jdbc:derby://localhost:7001/JP_JHU_DERBY", username, password);
I have the derby.jar file in my Java/Extensions directory--without that the embedded driver was not being found. So I have a few Q's:
Shouldn't it have a JDBC driver from the Class.forName()
method? Why have problems all of a sudden at getConnection()
?
I thought I didn't even have to load a driver with the newer JDK's. I am using Netbeans and (succesfully, I think) set the netbeans.conf file to the latest JDK (with "netbeans_jdkhome="/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home"). What am I missing?
Upvotes: 0
Views: 517
Reputation:
Apache Derby can be run in two different modes:
The driver org.apache.derby.jdbc.EmbeddedDriver
can only handle in-memory databases. The URL for that has the format "jdbc:derby:/path/to/database"
.
But your URL is one for a network server, which isn't handled by the embedded driver. To connect to a derby server, you have to use the driver class org.apache.derby.jdbc.ClientDriver
Upvotes: 1