0

well, there are so many threads discussed about this topic , but unfortunately nothing worked for me .

I am sending username/pwd to the server and server is interacting with JDBC client . this is my goal .

but I am getting above mentioned error while executing the below piece of code

ERROR: Class.forName("org.apache.derby.jdbc.ClientDriver").newInstance();

CLASSPATH varaible here : C:\ProgramFiles\Java\jdk1.7.0_17\bin;C:\ProgramFiles\Java\jdk1.7.0_17\db\lib;C:\ProgramFiles\Java\jdk1.7.0_17\db\lib\derbyclient.jar;

I'm pretty sure this jar contains ClientDriver.class . I dont know where I did mistake .. anyone pls help me .

hs.chandra
  • 707
  • 1
  • 7
  • 19
Gobi
  • 41
  • 1
  • 6
  • Tried this one, [http://stackoverflow.com/questions/7631758/how-to-connect-sql-server-using-jtds-driver-in-android/13512108#13512108] see here[/link] – KumailR Jul 16 '13 at 05:55

2 Answers2

0

The CLASSPATH environment variable is almost never used. Make sure the 'derbyclient.jar' is on the actual classpath of your application.

  • If running from the IDE: make sure it is on the IDE build path of your application
  • If running with java -jar ... make sure it is in the Class-path attribute of the META-INF/MANIFEST.MF
  • If running with java -cp ... make sure it is in the -cp list.

Also if you are using a JDBC 4 compliant driver, you don't need to call Class.forName("org.apache.derby.jdbc.ClientDriver"), calling newInstance() is never necessary to load the driver (unless you are using Java 1.0 or 1.1 which you aren't).

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
0

You must add derbyclient.jar to YourProject\WebContent\WEB-INF\lib. Not needed to add derby.jar to classpath.

It's helped me.

mkczyk
  • 2,460
  • 2
  • 25
  • 40