# Liquibase commandline: diff

**URL:** <https://forum.liquibase.org/t/liquibase-commandline-diff/2895>\
**Category:** General Discussion\
**Created:** [February 11, 2014, 10:15pm UTC](https://forum.liquibase.org/t/liquibase-commandline-diff/2895 "2014-02-11T22:15:00Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![apavlenko](https://avatars.discourse-cdn.com/v4/letter/a/3be4f8/32.png) [@apavlenko](https://forum.liquibase.org/u/apavlenko)\
**Post date:** [February 11, 2014, 10:15pm UTC](https://forum.liquibase.org/t/liquibase-commandline-diff/2895/1 "2014-02-11T22:15:00Z")

</div>

Hi, colleagues. I have quistion regarding **diff** or **diffChangeLog** usage from liquibase commandline tool.

I have latest liquibase unzipped on my pc and I’ve put need drivers into lib folder.

So, here is my **liquibase properties:**

1. 
2. driver=net.sourceforge.jtds.jdbc.Driver
3. classpath=jtds-1.3.1.jar
4. changeLogFile=…/my-service/src/main/resources/db/migration/my-changelog.xml
5. url=jdbc:jtds:sqlserver://localhost:1433/sample
6. username=sa
7. password=sa
8. referenceUrl=hibernate:spring:com.my.dao.entities
9. referenceDriver=net.sourceforge.jtds.jdbc.Driver
10. referenceUsername=sa
11. referencePassword=sa
12. includeSystemClasspath=true
13. logLevel=DEBUG

And I have next error.&nbsp;

1. 
2. \>java -jar liquibase.jar diffChangeLog
3. DEBUG 11.02.14 16:04:liquibase: Connected to sa@jdbc:jtds:sqlserver://localhost:1433/sample
4. DEBUG 11.02.14 16:04:liquibase: Setting auto commit to false from true
5. Liquibase diffChangeLog Failed: liquibase.exception.DatabaseException: liquibase.exception.DatabaseException: Connection could not be created to hibernate:spring:com.my.dao.entities with driver net.sourceforge.jtds.jdbc.Driver. &nbsp;Possibly the wrong driver for the given database URL
6. SEVERE 11.02.14 16:04:liquibase: liquibase.exception.DatabaseException: liquibase.exception.DatabaseException: Connection could not be created to hibernate:spring:com.my.dao.entities with driver net.sourceforge.jtds.jdbc.Driver. &nbsp;Possibly the wrong driver for the given database URL
7. liquibase.exception.DatabaseException: liquibase.exception.DatabaseException: liquibase.exception.DatabaseException: Connection could not be created to hibernate:spring:com.my.dao.entities with driver net.sourceforge.jtds.jdbc.Driver. &nbsp;Possibly the wrong driver for the given database URL
8. &nbsp; &nbsp; &nbsp; &nbsp; at liquibase.integration.commandline.CommandLineUtils.createDatabaseObject(CommandLineUtils.java:61)
9. &nbsp; &nbsp; &nbsp; &nbsp; at liquibase.integration.commandline.Main.createReferenceDatabaseFromCommandParams(Main.java:1005)
10. &nbsp; &nbsp; &nbsp; &nbsp; at liquibase.integration.commandline.Main.doMigration(Main.java:804)
11. &nbsp; &nbsp; &nbsp; &nbsp; at liquibase.integration.commandline.Main.main(Main.java:133)
12. Caused by: liquibase.exception.DatabaseException: liquibase.exception.DatabaseException: Connection could not be created to hibernate:spring:com.my.dao.entities with driver net.sourceforge.jtds.jdbc.Driver. &nbsp;Possibly the wrong driver for the given database URL
13. &nbsp; &nbsp; &nbsp; &nbsp; at liquibase.database.DatabaseFactory.openConnection(DatabaseFactory.java:231)
14. &nbsp; &nbsp; &nbsp; &nbsp; at liquibase.database.DatabaseFactory.openDatabase(DatabaseFactory.java:141)
15. &nbsp; &nbsp; &nbsp; &nbsp; at liquibase.integration.commandline.CommandLineUtils.createDatabaseObject(CommandLineUtils.java:52)
16. &nbsp; &nbsp; &nbsp; &nbsp; ... 3 more
17. Caused by: liquibase.exception.DatabaseException: Connection could not be created to hibernate:spring:com.my.dao.entities with driver net.sourceforge.jtds.jdbc.Driver. &nbsp;Possibly the wrong driver for the given database URL
18. &nbsp; &nbsp; &nbsp; &nbsp; at liquibase.database.DatabaseFactory.openConnection(DatabaseFactory.java:226)
19. &nbsp; &nbsp; &nbsp; &nbsp; ... 5 more
20.   

The same happent also for

1. referenceDriver=com.microsoft.sqlserver.jdbc.SQLServerDriver

Does anybody have an idea?

---

<div class="post-metadata">

**Author:** ![nvoxland](https://avatars.discourse-cdn.com/v4/letter/n/87869e/32.png) [@nvoxland](https://forum.liquibase.org/u/nvoxland)\
**Post date:** [February 11, 2014, 10:15pm UTC](https://forum.liquibase.org/t/liquibase-commandline-diff/2895/2 "2014-02-11T22:15:00Z")

</div>

Leave the referenceDriver off. There is a hibernate driver that liquibase will default to for a hibernate: url.

Nathan

---

<div class="post-metadata">

**Author:** ![un1393003641748r86id](https://avatars.discourse-cdn.com/v4/letter/u/97f17d/32.png) [@un1393003641748r86id](https://forum.liquibase.org/u/un1393003641748r86id)\
**Post date:** [February 11, 2014, 10:15pm UTC](https://forum.liquibase.org/t/liquibase-commandline-diff/2895/3 "2014-02-11T22:15:00Z")

</div>

Hi,

First thanks for this great framework and plugin!

I’m having a similar problem while running liquibase-hibernate from maven. I started with

hibernate:spring:my.package?dialect=org.hibernate.dialect.Oracle10gDialect

I had an error message saying :

[ERROR] Failed to execute goal org.liquibase:liquibase-maven-plugin:3.1.1:diff (

default-cli) on project bel-schema-migrate: Error setting up or running Liquibas

e: liquibase.exception.DatabaseException: java.lang.RuntimeException: Cannot fin

d database driver: **Driver class was not specified and could not be determined fr**

**om the url** (hibernate:spring:my.package?dialect=org.hibernate.dialect

.Oracle10gDialect) -\> [Help 1]

So I added the driver as follow :

hibernate:spring:my.package?dialect=org.hibernate.dialect.Oracle10gDialect

oracle.jdbc.OracleDriver

Which led to the same error as the one described by Apavlenko :

[ERROR] Failed to execute goal org.liquibase:liquibase-maven-plugin:3.1.1:diff (

default-cli) on project bel-schema-migrate: Error setting up or running Liquibas

e: liquibase.exception.DatabaseException: liquibase.exception.DatabaseException:

&nbsp; **Connection could not be created to hibernate:spring:my.package?diale**

**ct=org.hibernate.dialect.Oracle10gDialect with driver oracle.jdbc.OracleDriver.**

**&nbsp;Possibly the wrong driver for the given database** URL -\> [Help 1]

Can you suggest a workaround?

Thanks,

Martin

---

<div class="post-metadata">

**Author:** ![nvoxland](https://avatars.discourse-cdn.com/v4/letter/n/87869e/32.png) [@nvoxland](https://forum.liquibase.org/u/nvoxland)\
**Post date:** [February 11, 2014, 10:15pm UTC](https://forum.liquibase.org/t/liquibase-commandline-diff/2895/4 "2014-02-11T22:15:00Z")

</div>

You shouldn’t include the referenceDriver block.

Nathan

---

<div class="post-metadata">

**Author:** ![nvoxland](https://avatars.discourse-cdn.com/v4/letter/n/87869e/32.png) [@nvoxland](https://forum.liquibase.org/u/nvoxland)\
**Post date:** [February 11, 2014, 10:15pm UTC](https://forum.liquibase.org/t/liquibase-commandline-diff/2895/5 "2014-02-11T22:15:00Z")

</div>

Does it work with setting the driver to&nbsp;liquibase.ext.hibernate.database.connection.HibernateDriver ? &nbsp;And/or is the liquibase-hibernate jar in your classpath?

Nathan

---

<div class="post-metadata">

**Author:** ![un1393003641748r86id](https://avatars.discourse-cdn.com/v4/letter/u/97f17d/32.png) [@un1393003641748r86id](https://forum.liquibase.org/u/un1393003641748r86id)\
**Post date:** [February 11, 2014, 10:15pm UTC](https://forum.liquibase.org/t/liquibase-commandline-diff/2895/6 "2014-02-11T22:15:00Z")

</div>

Hi,

When ommiting the referenceDriver block there is an error saying:

.Oracle10gDialect) -\> [Help 1]

---

<div class="post-metadata">

**Author:** ![un1393003641748r86id](https://avatars.discourse-cdn.com/v4/letter/u/97f17d/32.png) [@un1393003641748r86id](https://forum.liquibase.org/u/un1393003641748r86id)\
**Post date:** [February 11, 2014, 10:15pm UTC](https://forum.liquibase.org/t/liquibase-commandline-diff/2895/7 "2014-02-11T22:15:00Z")

</div>

Hi,

Yes liquibase hibernate is in the path.&nbsp;

I tried removing the dialect but it did not change anything.

java.lang.NullPointerException  
at liquibase.executor.jvm.JdbcExecutor$QueryCallableStatementCallback.do  
InCallableStatement(JdbcExecutor.java:363)  
at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:80)  
at liquibase.executor.jvm.JdbcExecutor.query(JdbcExecutor.java:116)  
at liquibase.executor.jvm.JdbcExecutor.query(JdbcExecutor.java:127)  
at liquibase.executor.jvm.JdbcExecutor.queryForObject(JdbcExecutor.java:135)  
at liquibase.executor.jvm.JdbcExecutor.queryForObject(JdbcExecutor.java:146)  
at liquibase.executor.jvm.JdbcExecutor.queryForObject(JdbcExecutor.java:141)  
at liquibase.database.AbstractJdbcDatabase.getConnectionSchemaName(AbstractJdbcDatabase.java:341)  
at liquibase.database.AbstractJdbcDatabase.getDefaultSchemaName(AbstractJdbcDatabase.java:324)  
at liquibase.snapshot.jvm.SchemaSnapshotGenerator.snapshotObject(SchemaSnapshotGenerator.java:44)  
at liquibase.snapshot.jvm.JdbcSnapshotGenerator.snapshot(JdbcSnapshotGenerator.java:59)  
at liquibase.snapshot.SnapshotGeneratorChain.snapshot(SnapshotGeneratorChain.java:47)  
at liquibase.snapshot.jvm.JdbcSnapshotGenerator.snapshot(JdbcSnapshotGenerator.java:62)  
at liquibase.snapshot.SnapshotGeneratorChain.snapshot(SnapshotGeneratorChain.java:47)  
at liquibase.snapshot.jvm.JdbcSnapshotGenerator.snapshot(JdbcSnapshotGenerator.java:62)  
at liquibase.snapshot.SnapshotGeneratorChain.snapshot(SnapshotGeneratorChain.java:47)  
at liquibase.snapshot.jvm.JdbcSnapshotGenerator.snapshot(JdbcSnapshotGenerator.java:62)  
at liquibase.snapshot.SnapshotGeneratorChain.snapshot(SnapshotGeneratorChain.java:47)  
at liquibase.snapshot.DatabaseSnapshot.include(DatabaseSnapshot.java:131)  
at liquibase.snapshot.DatabaseSnapshot.(DatabaseSnapshot.java:36)  
at liquibase.snapshot.SnapshotGeneratorFactory.createSnapshot(SnapshotGeneratorFactory.java:129)  
at liquibase.snapshot.SnapshotGeneratorFactory.createSnapshot(SnapshotGeneratorFactory.java:122)  
at liquibase.snapshot.SnapshotGeneratorFactory.createSnapshot(SnapshotGeneratorFactory.java:110)  
at liquibase.integration.commandline.CommandLineUtils.doDiffToChangeLog(CommandLineUtils.java:84)  
at org.liquibase.maven.plugins.LiquibaseDatabaseDiff.performLiquibaseTask(LiquibaseDatabaseDiff.java:148)  
at org.liquibase.maven.plugins.AbstractLiquibaseMojo.execute(AbstractLiquibaseMojo.java:377)  
at org.liquibase.maven.plugins.LiquibaseDatabaseDiff.execute(LiquibaseDatabaseDiff.java:128)  
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:107)  
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)  
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)  
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)  
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)  
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)  
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)  
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)  
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)  
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)  
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:534)  
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)  
at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)  
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)  
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:48)  
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)  
at java.lang.reflect.Method.invoke(Method.java:600)  
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)  
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)  
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)  
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)

---

<div class="post-metadata">

**Author:** ![nvoxland](https://avatars.discourse-cdn.com/v4/letter/n/87869e/32.png) [@nvoxland](https://forum.liquibase.org/u/nvoxland)\
**Post date:** [February 11, 2014, 10:15pm UTC](https://forum.liquibase.org/t/liquibase-commandline-diff/2895/8 "2014-02-11T22:15:00Z")

</div>

I pushed a change that may fix your problem. I’m planning on having an updated liquibase-hiberate release early next week.

I attached a zip file renamed as .txt with the newest liquibase-hibernate.jar if you wanted to try it before then.

Nathan

---

<div class="post-metadata">

**Author:** ![un1393003641748r86id](https://avatars.discourse-cdn.com/v4/letter/u/97f17d/32.png) [@un1393003641748r86id](https://forum.liquibase.org/u/un1393003641748r86id)\
**Post date:** [February 11, 2014, 10:15pm UTC](https://forum.liquibase.org/t/liquibase-commandline-diff/2895/9 "2014-02-11T22:15:00Z")

</div>

Hello,

Thank you for sharing the jar update in advance 🙂

I changed my pom to use your snapshot as follow

om the url (hibernate:spring:ma.awb.ebk.bel.domain?dialect=org.hibernate.dialect.Oracle10gDialect) -\> [Help 1]

---

<div class="post-metadata">

**Author:** ![un1393003641748r86id](https://avatars.discourse-cdn.com/v4/letter/u/97f17d/32.png) [@un1393003641748r86id](https://forum.liquibase.org/u/un1393003641748r86id)\
**Post date:** [February 11, 2014, 10:15pm UTC](https://forum.liquibase.org/t/liquibase-commandline-diff/2895/10 "2014-02-11T22:15:00Z")

</div>

Hi,

I’m trying to understand the problem by reading the source from github.

Looking at the repo [1], it seems line 66 mentionned in [2] can’t trigger a NPE.

https://github.com/liquibase/liquibase/blob/master/liquibase-core/src/main/java/liquibase/executor/jvm/JdbcExecutor.java
