Search code examples
sqleclipsejakarta-eejdbcderby

Updating JDBC driver in Eclipse for Derby 10.9


So I am running into an issue right now.... and I need your help. I am trying to get a Derby JDBC driver setup in Eclipse. The Derby driver I downloaded was 10.9, but the Driver that is in Eclipse says it is "System Version 10.2".

I went to Window -> Preferences, Data Management, Connectivity, Driver Definition, then created a new one. I select the latest version of the Derby Embedded JDBC Driver, which is 10.2. I then include the derby.jar file in the JAR List then click OK.

Then, in Eclipse again, I go to "Data Source Explorer" then right click on Database Connections -> New... I select Derby, then select the Driver I just used, add a user/pass, then click Finish.

It creates the DB just fine... But when I use the following code I get an errror:

String host = "jdbc:derby:C:\\Users\\Samson\\MyDB;create=true";
String user = "admin";
String pass = "admin";
try {
    java.sql.Connection conn = DriverManager.getConnection(host, user, pass);
} catch (SQLException e) {
    e.printStackTrace();
}

The error is:

ERROR XSLAN: Database at C:\Users\Samson\MyDB has an incompatible format with the current version of the software. The database was created by or upgraded by version 10.9.

So it seems like it is trying to connect to this 10.9 database with a 10.2 driver for some reason but I can't figure out what I'm doing wrong. Any ideas? Thanks!!

Edit: Okay so the above code is placed within a Java Servlet if that helps. I created a new project called "DBConnect" and placed the lib for derby inside it and created a simple program to connect to the DB and it worked just fine. So it's related to my Servlet.

Edit2: Nothing like being an idiot in your first post to StackOverflow. I have to update the Derby driver in Geronimo as it is only using 10.2 instead of 10.9.

Edit3: On my work PC it is giving me the same issue. For some reason whenever I create a regular Java project it works fine, but whenever I try to use a Java Servlet to connect to this database I still get the error. If anyone has any suggestions I am open to it.

Edit4: Looks like the Geronimo installation is using 10.8.2.2_1, but I still have no clue how to actually get it updated. Going to try and just download the 10.8 driver for now and deal with this at a later time.

Edit5: Yeah it looks like I can't really use the Data Source Explorer in Eclipse for some reason. I have 10.8.2.2_1 installed and I can get my servlet to save/read from the DB just fine, but when I try to connect using the Data Source Explorer it just doesn't even show the Table I created.

Edit6: Sigh... Well 10.8 did, in fact, work. I just wasn't looking in the right Schema. I feel like an idiot.


Solution

  • I went ahead and installed derby 10.8 instead of 10.9 and it seems to be working just fine now. Geronimo was setup to use 10.8 instead of 10.9.