Hi I have a problem with my Java program, when I run the application within JDeveloper, the program works fine, it connects to the derby database properly. When I create a executable jar i get the following error no suitable driver found for jdbc:derby://localhost:1527/c:..../dbcam

i have tried the following

    { public void DoConnect3( ) {

  try {
       Class.forName("org.apache.derby.jdbc.EmbeddedDriver");
       // conenct to the database
      // String host ="jdbc:derby://localhost:1527/dbCam";
       //String host ="jdbc:derby://localhost:1527/C:/Users/nasir/SkyDrive/Java/db_Backup/dbCam";
       String host ="jdbc:derby://localhost:1527/C:/Users/nasir/.netbeans-derby/dbCam";
       String uName ="userCam";
       String uPass ="cam";
       con = DriverManager.getConnection(host,uName,uPass);
       stmt = con.createStatement( ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE );
       //String sql = "SELECT * FROM tableCustomer";
       String sql = "SELECT * FROM tableTroubleshooting";
       //String tsss = Integer.toString(tss);
       //String sql = "SELECT * FROM tableTroubleshooting where ProbID  "+"'"+tsss+"'";
        rs = stmt.executeQuery(sql);
       rs.next();

   }

That still doesn't do much only shows me message saying org.apache.derby.clientdriver.

Any suggestions would be gratefully appreciated.

Thanks

有帮助吗?

解决方案

The url you're using is a ClientDriver url, not an EmbeddedDriver url. You need to add the correct jar and load the correct driver.

HTH

D

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top