4

I've downloaded the drivers via Maven Central (org.apache.derby).

  1. derby-10.15.1.3.jar
  2. derbyclient-10.15.1.3.jar
  3. derbynet-10.15.1.3.jar
  4. derbyshared-10.15.1.3.jar

So what am I missing ? None of these JARs contains the package "org.apache.derby.jdbc", which used to contain the ClientDriver and EmbeddedDriver in the past?

Per Digre
  • 346
  • 3
  • 8
  • 2
    According to [the release notes](http://db.apache.org/derby/releases/release-10.15.1.3.cgi#New+Features) 10.15 is now using Java modules. ["Existing users who want to run Derby with a module path should consult the module diagrams in the javadoc"](https://db.apache.org/derby/docs/10.15/publishedapi/index.html) –  Jul 26 '19 at 08:59
  • Ok I'm using Java 11. I assume I use Class.forName(driverClass) ? Unfortunately I am new to modules, how do I make them visible on classpath ? Examples would be much appreciated. – Per Digre Jul 26 '19 at 09:56
  • 2
    I don't normally use Derby, but just from reading those release notes, it looks like you need the derbytools JAR. And instead of manually downloading things from Maven, use Maven (or Gradle), as they will automatically download any necessary dependencies. – Mark Rotteveel Jul 26 '19 at 12:54
  • I was missing derbytools..... Thanks guys. – Per Digre Aug 01 '19 at 13:19

2 Answers2

10

Indeed, to use the Derby client driver with Derby 10.15, you now need all three of: derbyclient.jar, derbyshared.jar, and derbytools.jar. This is (weakly) documented here:

A new jar file (derbyshared.jar) has been added. All Derby configurations require it. In addition, the derbytools.jar library is now required when running the network server and/or when using Derby DataSources.

Since you are running the network server, you now require derbytools.jar (as well as the new derbyshared.jar when running the client software.

I think it would be worth suggesting to the Derby community that the release note could make this stand out more clearly (you could file an improvement request with the Derby project, e.g.)

Bryan Pendleton
  • 16,128
  • 3
  • 32
  • 56
  • 1
    Thanks, I was missing out the "derbytools". I also changed to use the new "org.apache.derby.client.ClientAutoloadedDriver". Fortunately there's no need to mess around with Java 9 Modularity. – Per Digre Aug 01 '19 at 13:18
0

It looks like derbytools depends on derbyshared, so you don't have to list derbyshared as a dependency in your pom.xml (just derbytools).

However, this seems to work counter to how every other jdbc client works for every other database. Rather than updating documentation to say you have to include extra dependencies, Derby should make the derbyclient stand alone (better solution) or have the maven derbyclient depend on derbytools (so that when this dependency problem is fixed, people won't have to go back and update their pom.xmls to remove unneeded dependencies).