liquibase diff; Cannot find database driver

Hi!

 I am triyng to launch this command-line comparison:

liquibase.bat --classpath=C:\liquibase-2.0.5-bin\ojdbc14.jar --driver=oracle.jdbc.OracleDriver --url=jdbc:oracle:thin:@PC-240484.abg.corp:1521:XE    --username=test     --password=test  diff   --referenceDriver=org.apache.derby.jdbc.EmbeddedDriver  --referenceUrl=jdbc:derby:c:/test   --referenceUsername=test     --referencePassword=arce97

But it returns the following error:

SEVERE 23/01/13 9:38:liquibase: Cannot find database driver: org.apache.derby.jdbc.EmbeddedDriver
liquibase.exception.DatabaseException: java.lang.RuntimeException: Cannot find database driver: org.apache.derby.jdbc.EmbeddedDriver

It is something extrange because if a launch a liquibase -update with this missing driver defined in liquibase.properties the update runs ok.

What can happen?

No answer?

i got the samething with the exception that  i’m using mysql :s

It seems that no one will answer this question .  does any one still use this tool at least ???

Liquibase is using some stupid classLoader trick. That’s where the problem comes from. Try adding classpath to your liquibase.properties file instead of using command line arguments.
This worked for me
#######################
url=jdbc:hsqldb:mem:file:test
username=SA
password=
defaultSchemaName=PUBLIC
changeLogFile=master.xml
classpath=hsqldb-2.2.8.jar


Liquibase is a great tool. Though it really does some classloader trick. When your jars are in java’s classpath but they are not specified in liquibase’s classpath property - it will say “Cannot find database driver”.

And I missed something when answering the original question. el_litos provided classpath only for Oracle driver and not for Derby. That was his problem.

Liquibase is not using any classloader tricks.  Adding classpath to your liquibase.properties file is exactly the same as adding it via the --classpath switch.


One nice undocumented thing is that liquibase will automatically add any jars that are present in its lib directory to the classpath.  Don’t have a lib directory?  Make one, and put your database driver .jar files in there.  Then you don’t have to add them to any Liquibase classpath manually.


Another nice undocumented thing (noticing a trend?) is that the --driver argument is not required.  JDBC will find the proper driver to handle the URL for you.


So if you couple these two things together, you can lose a big chunk off your arguments to liquibase.


Best,

Laird


http://about.me/lairdnelson