Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Playframework 2 SQLite

I am trying to get SQLite working with the playframework but so far no luck.

I have Downloaded sqlitejdbc-v056.jar and put it into the lib folder.

I then changed the application.conf:

db.driver=org.sqlite.JDBC
db.url="jdbc:sqlite:/db/geolookup.sqlite"
db.default.user=sa
db.default.password=sa

I created a folder db and drop my sqlite db into it.

Now I start play with play run

Everything seems to compile ok, but when I call the url: http://127.0.0.1:9000

I get the following error:

driver.url has type STRING rather than OBJECT with the following line highlited:

db.driver=org.sqlite.JDBC

What am I missing?

like image 546
PWFraley Avatar asked Apr 22 '12 08:04

PWFraley


2 Answers

try this:

db.default.driver="org.sqlite.JDBC"
db.default.url="jdbc:sqlite:/home/tex/dbtest"
db.default.user="sa"
db.default.password=""

Notice that the folder of the db must be an absolute path !

(BTW: with this configuration the application starts but when I try to run the evolution it throws an exception, I think this is a "dialect" problem...)

Hope this helps...

like image 101
giates Avatar answered Jan 03 '23 12:01

giates


You are propably using the wrong method to get the data from the config. From your error I assume you use it like this:

configuration.getConfig("db.driver")

But this method expects an JSON object under the path "db.driver". Since under the "db.driver" path you have a string, you should read the data using this method:

configuration.getString("db.driver")

This will make the "rather than OBJECT" error go away.

like image 21
Paweł Kozikowski Avatar answered Jan 03 '23 11:01

Paweł Kozikowski