Attempting to use JRuby 1.2.0 and Rails 2.3.2 with an embedded Derby database. I've copied derbytools.jar
and derby.jar
to $RUBY_HOME/lib
, yet rake db:migrate
still gives:
The driver encountered an error:
cannot load Java class org.apache.derby.jdbc.ClientDriver
Aaaand... I played a hunch and figured it out. So, I'll post this here in case somebody else runs into the same problem I did.
Almost all the documentation I found online has the following database.yml
configuration for Derby:
development:
adapter: jdbc
driver: org.apache.derby.jdbc.ClientDriver
url: jdbc:derby:[db];create=true
username: xxx
password: xxx
This probably works fine for a client/server setup, but for an embedded Derby setup, you need this:
development:
adapter: jdbc
driver: org.apache.derby.jdbc.EmbeddedDriver
url: jdbc:derby:[db];create=true
username: xxx
password: xxx
Note the 'EmbeddedDriver', and not 'ClientDriver'.