db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marcin Krol <mrk...@gmail.com>
Subject java.sql.SQLException: No suitable driver
Date Fri, 28 May 2010 16:44:58 GMT
Hello everyone,

I'm trying to use Derby here as embedded database in our test automation 
framework (that deploys itself on the remote endpoint and executes some 
Java classes to test functionality of the product).

Code:

private void createDerbyConnection() throws ClassNotFoundException, 
SQLException
{
     Class.forName("org.apache.derby.jdbc.EmbeddedDriver");
     String dburl = "jdbc:derby:DerbyDB;create=true";
     derbyconn = DriverManager.getConnection(dburl);
     derbyconn.setAutoCommit(false);
     derbyst = derbyconn.createStatement();
}


Now, the weird thing is that when the same class is using Derby in 
standalone program (ran e.g. on Linux) *on the same host*, or in Eclipse 
on my laptop, it all runs fine - I can connect to the db and operate on 
it all right.

It's only when I deploy the thing remotely, I get exception 
"java.sql.SQLException: No suitable driver" on line:

derbyconn = DriverManager.getConnection(dburl);

Note: the EmbeddedDriver jdbc class is most probably loaded fine, which 
is reinforced by the fact that if I delete derby.jar from classpath I 
get ClassNotFoundException.

Some people on the net suggested that this exception is being caused by 
wrong db url, but I can't see what's possibly wrong with my db url. I 
was under impression that this is correct dburl for embedded derby 
driver which should be in derby.jar.


-- 

Regards,
mk

--
Premature optimization is the root of all fun.

Mime
View raw message