-1

![JAVADB_DRIVER_LABEL library missing][1]

I am trying to connect to a JavaDB through netbeans 8 IDE on Windows 7. i can connect it using the DB manager provided with netbeans in Services panel. But when trying to connect it through my code I get ClassNotFoundException for the org.apache.derby.jdbc.ClientDriver class.

I could not run the Apache tomcat server on my machine, so I am Using the Glassfish server 4 that comes with netbeans.

my code to connect to the DB is as follows:

String url = "jdbc:derby://localhost:1527/sample;UID=app;PWD=app";
Class.forName("org.apache.derby.jdbc.ClientDriver");
conn = DriverManager.getConnection(url);

This similar code worked with SQL server, MS Access.

M Khetan
  • 69
  • 1
  • 3

3 Answers3

0

Please add your jdbc driver to the classpath of your project. It should work. Currently, the class loader is unable to load your driver class as it does it does not find it in the classpath

Pratik
  • 1,122
  • 8
  • 26
  • Thanks. I have added the requisite library to the project. see the screen shot at [link] https://www.dropbox.com/s/zjrebxpoh066l4h/Screenshot%202015-04-16%2015.56.31.png?dl=0. – M Khetan Apr 16 '15 at 10:28
  • Cool. Please mark an answer as correct so that it could help others too. – Pratik Apr 16 '15 at 12:06
0

Download the version of Apache Derby you need from here. Extract the zip and you should get derbyclient.jar which has the class org.apache.derby.jdbc.ClientDriver.

FYI : If your application runs on JDK 1.6 or higher, then you do not need to explicitly load the EmbeddedDriver. In that environment, the driver loads automatically.

Aniket Thakur
  • 66,731
  • 38
  • 279
  • 289
  • Thank you for reply. I have tried adding the jar files to the library through "Add JAR/Folder". I am new to J2EE and netbeans. So don't know how to add the jar file in classpath. I am using Netbeans 8 with JDK7, but still not loading. – M Khetan Apr 16 '15 at 10:23
  • I tried the library found at http://central.maven.org/maven2/org/apache/derby/derbyclient/10.11.1.1/derbyclient-10.11.1.1.jar Added it to the project and it worked. thank you all. – M Khetan Apr 16 '15 at 10:50
0

You need to add derbyclient.jar to your classpath. You can find this jar in the download package of derby from here. This jar contains your org.apache.derby.jdbc.ClientDriver.

For more information, see this answer : where is org.apache.derby.jdbc.ClientDriver?

Community
  • 1
  • 1
Aakash
  • 2,029
  • 14
  • 22
  • Thanks for replying. Done that. no help! see the screen shot at [link]https://www.dropbox.com/s/zjrebxpoh066l4h/Screenshot%202015-04-16%2015.56.31.png?dl=0 – M Khetan Apr 16 '15 at 10:29
  • I tried the library found at http://central.maven.org/maven2/org/apache/derby/derbyclient/10.11.1.1/derbyclient-10.11.1.1.jar Added it to the project and it worked. thank you all. – M Khetan Apr 16 '15 at 10:50
  • If this answers your question, please mark it as selected answer. – Aakash Apr 16 '15 at 10:51