You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-user@db.apache.org by Daniel Faria <wo...@hotmail.com> on 2015/08/28 20:26:10 UTC

Question: not being able to connect to Derby JDBC network driver

Hello Derby community developers and testers,

I would like to ask you a question regarding an exercise from the "Getting Started" guide.

So I was able to run the JDBC program using the embedded driver without a problem. However I wasn't quite as lucky when trying to use the Client driver and Network Server (as featured on page 31). I had no problem starting the server (aas you can see I've even tried to force it to use port 1527 with the -p parameter but I've also tried without specifying the port, relying on the default value instead) and the service appears to be ready and listening. But when I make the suggested modifications to WwdClient.java and then compile it, it doesn't seem to work.
Please note the following:

C:\Users\dfaria\Desktop\Projects\Java\DERBYTUTOR>java -jar %DERBY_HOME%\lib\derbyrun.jar server start -p 1527
Fri Aug 28 15:00:25 BRT 2015 : Security manager installed using the Basic server security policy.
Fri Aug 28 15:00:25 BRT 2015 : Apache Derby Network Server - 10.11.1.1 - (1616546) started and ready to accept connections on port 1527


Using the instructions you suggested (to change the source code and then recompile):
Original definitions
String driver = "org.apache.derby.jdbc.EmbeddedDriver";
String dbName="jdbcDemoDB";
String connectionURL = "jdbc:derby:" + dbName + ";create=true";

New definitions
String driver = "org.apache.derby.jdbc.ClientDriver"; 
String connectionURL = "jdbc:derby://localhost:1527/" + dbName + ";create=true"; 


But when I run the newly compiled WwdClient file, I get the following error:
C:\Users\dfaria\Desktop\Projects\Java\DERBYTUTOR>java WwdClient . . . exception thrown:java.sql.SQLException: No suitable driver found for jdbc:derby://localhost:1527/jdbcDemoDB;create=true        at java.sql.DriverManager.getConnection(Unknown Source)        at java.sql.DriverManager.getConnection(Unknown Source)        at WwdClient.main(WwdClient.java:38)Getting Started With Derby JDBC program ending.

I am not sure why that is...I have gone through the source code syntax many times over and cannot see anything wrong with it. I have kept two shell windows open (as instructed) with one running the server program. Would you have any suggestions? Please advise.

Thank you very much in advance!


Best regards,

Daniel Faria 		 	   		  

Re: Question: not being able to connect to Derby JDBC network driver

Posted by Bryan Pendleton <bp...@gmail.com>.
> *java.sql.SQLException: No suitable driver found for jdbc:derby://localhost:1527/jdbcDemoDB;create=true*

This exception is telling you that derbyclient.jar is not in your CLASSPATH.

bryan