JDBC Derby driver not found
You said you have followed the tutorial. In the tutorial you had to install JDBC driver.
Installing a JDBC driver generally consists of copying the driver to your computer, then adding the location of it to your class path.
After installing the driver you run
java.lang.ClassNotFoundException: org.apache.derby.jdbc.EmbeddedDriver
That is only possible if you messed the correct diver.
You have used
org.apache.derby.jdbc.EmbeddedDriver
to load the driver
but should use
org.apache.derby.jdbc.ClientDriver
If you have this type of error
java.lang.ClassNotFoundException: org.apache.derby.jdbc.ClientDriver
and you are using netbeans
then you have to follow these steps:
- right click on library
- choose add library option and from the list of libraries choose "Java DB Driver"
Java JDK comes with both
org.apache.derby.jdbc.EmbeddedDriver
org.apache.derby.jdbc.ClientDriver
Within eclipse add the following jars to the used JRE(JDK) or explicitly to your project.
[JDK]db/lib/derby.jar (EmbeddedDriver)
[JDK]db/lib/derbyclient.jar (ClientDriver)
For runtine you needed to made the appropriates jar available for your java application.
java.sql.SQLException: No suitable driver found for jdbc:derby:db directory
So your error can be caused by:
Driver is not loaded correctly or your URL
is malformed. So at first you need to ensure that your *.jar
is in classpath. Check it out.
Also try to change your URL
to:
jdbc:derby://<path>/<databasename>;create=true
create=true
will ensure that db will be created if does not exist.
Update:
Look at this thead also: SQLException: No suitable driver found for jdbc:derby://localhost:1527