1

How do I go about actually creating a SQLite DB-file? This command won't work:

liquibase --driver=jdbc.driver.sqlite --changeLogFile=assets_db.xml --url=file.db update

With the error:

Migration Failed: Cannot find database driver: jdbc.driver.sqlite
JDW
  • 175
  • 3
  • 12

2 Answers2

3

It seems that you don't have the sqlite JDBC driver.

Have you downloaded the JDBC driver for sqlite? If not try this one:

http://www.zentus.com/sqlitejdbc/

And the correct liquibase command will be:

liquibase --driver=org.sqlite.JDBC

Hope this work for you.

pmariano
  • 166
  • 5
  • Coomand "liquibase --driver=org.sqlite.JDBC --changeLogFile=assets_db.xml --url=file.db update" now yields "Migration Failed: Connection could not be created to file.db with driver java.lang.String. Possibly the wrong driver for the given database URL" – JDW Dec 16 '10 at 12:12
  • but, have you downloaded de sqlite JDBC driver? Now seems that is a problem with file.db – pmariano Dec 16 '10 at 12:35
  • 1
    You probably need prepend `jdbc:sqlite:` to your `url` – barti_ddu Dec 16 '10 at 12:39
  • I downloaded "sqlitejdbc-v056.jar" and put it in the subfolder "lib" inside the liquibase folder. – JDW Dec 16 '10 at 12:45
  • 1
    @JDW: btw, if speed is an issue, i'd use xerial sqlite-jdbc implementation. – barti_ddu Dec 16 '10 at 12:50
  • @barti_ddu: Thanks for the tip about Xerial and URL - where should I have found that particular doc? – JDW Dec 16 '10 at 13:01
  • @JDW: mm.. what doc? If you mean exact url string, you can find it in "usage" example: http://www.xerial.org/trac/Xerial/wiki/SQLiteJDBC#Usage ; driver's difference from zentus' is also highlighted on their site. – barti_ddu Dec 16 '10 at 13:10
  • @pmariano: +1 to your answer, since it is conceptually correct. – barti_ddu Dec 16 '10 at 13:11
  • @barti_ddu thanks. I have never heard about performance issues with the common sqlite driver, really interesting. – pmariano Dec 16 '10 at 13:14
  • The link to zentus.com provided by @pmariano is broken. I've found the driver here: https://bitbucket.org/xerial/sqlite-jdbc/downloads/ – vrogach Apr 08 '18 at 16:42
3

This is a very old thread, but in googling for this it's one of the few hits that came up - so in case anyone else ever trips over the 'with driver java.lang.String' problem, here's a quick fix.

In my case, the URL in the properties file was surrounded with quotes (which is sometimes needed on the command line). Removing the quotes allowed liquibase to run fine. I believe the 'java.lang.string' error points to a problem in the JDBC URL - either bad formatting or unparseable content.

I hope this helps others...