# liquibase diff; Cannot find database driver

**URL:** <https://forum.liquibase.org/t/liquibase-diff-cannot-find-database-driver/2608>\
**Category:** Liquibase Development\
**Created:** [January 23, 2013, 4:52pm UTC](https://forum.liquibase.org/t/liquibase-diff-cannot-find-database-driver/2608 "2013-01-23T16:52:00Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![el\_litos](https://avatars.discourse-cdn.com/v4/letter/e/96bed5/32.png) [@el\_litos](https://forum.liquibase.org/u/el_litos)\
**Post date:** [January 23, 2013, 4:52pm UTC](https://forum.liquibase.org/t/liquibase-diff-cannot-find-database-driver/2608/1 "2013-01-23T16:52:00Z")

</div>

Hi!  
  
&nbsp;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&nbsp;&nbsp;&nbsp; --username=test &nbsp;&nbsp;&nbsp; --password=test&nbsp; diff&nbsp;&nbsp; --referenceDriver=org.apache.derby.jdbc.EmbeddedDriver&nbsp; --referenceUrl=jdbc:derby:c:/test &nbsp; --referenceUsername=test &nbsp;&nbsp;&nbsp; --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?

---

<div class="post-metadata">

**Author:** ![el\_litos](https://avatars.discourse-cdn.com/v4/letter/e/96bed5/32.png) [@el\_litos](https://forum.liquibase.org/u/el_litos)\
**Post date:** [January 23, 2013, 4:52pm UTC](https://forum.liquibase.org/t/liquibase-diff-cannot-find-database-driver/2608/2 "2013-01-23T16:52:00Z")

</div>

No answer?

---

<div class="post-metadata">

**Author:** ![Guest](https://avatars.discourse-cdn.com/v4/letter/g/8dc957/32.png) [@Guest](https://forum.liquibase.org/u/Guest)\
**Post date:** [January 23, 2013, 4:52pm UTC](https://forum.liquibase.org/t/liquibase-diff-cannot-find-database-driver/2608/3 "2013-01-23T16:52:00Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Guest](https://avatars.discourse-cdn.com/v4/letter/g/8dc957/32.png) [@Guest](https://forum.liquibase.org/u/Guest)\
**Post date:** [January 23, 2013, 4:52pm UTC](https://forum.liquibase.org/t/liquibase-diff-cannot-find-database-driver/2608/4 "2013-01-23T16:52:00Z")

</div>

It seems that no one will answer this question&nbsp; ![](https://sea2.discourse-cdn.com/flex020/ze/images/frowmn.gif). &nbsp;does any one still use this tool at least ???

---

<div class="post-metadata">

**Author:** ![Guest](https://avatars.discourse-cdn.com/v4/letter/g/8dc957/32.png) [@Guest](https://forum.liquibase.org/u/Guest)\
**Post date:** [January 23, 2013, 4:52pm UTC](https://forum.liquibase.org/t/liquibase-diff-cannot-find-database-driver/2608/5 "2013-01-23T16:52:00Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Guest](https://avatars.discourse-cdn.com/v4/letter/g/8dc957/32.png) [@Guest](https://forum.liquibase.org/u/Guest)\
**Post date:** [January 23, 2013, 4:52pm UTC](https://forum.liquibase.org/t/liquibase-diff-cannot-find-database-driver/2608/6 "2013-01-23T16:52:00Z")

</div>

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](http://forum.liquibase.org#user/el_litos) provided classpath only for Oracle driver and not for Derby. That was his problem.

---

<div class="post-metadata">

**Author:** ![ljnelson](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.liquibase.org/ljnelson/32/120_2.png) [@ljnelson](https://forum.liquibase.org/u/ljnelson)\
**Post date:** [January 23, 2013, 4:52pm UTC](https://forum.liquibase.org/t/liquibase-diff-cannot-find-database-driver/2608/7 "2013-01-23T16:52:00Z")

</div>

Liquibase is not using any classloader tricks. &nbsp;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. &nbsp;Don’t have a lib directory? &nbsp;Make one, and put your database driver .jar files in there. &nbsp;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. &nbsp;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](http://about.me/lairdnelson)
