Configure Server with a SQLite Database

David9 years ago

Hi Anton,

I'm trying to configure server with a SQLite Database.
H2Database goes fine... but there is -not exactly- friendly for non experimented users.

I had changed the traccar.xml file with:

<entry key='database.driver'>org.sqlite.JDBC</entry>
<entry key='database.url'>jdbc:sqlite:C:\Archivos de programa\Traccar\data\database.db</entry>
<entry key='database.user'></entry>
<entry key='database.password'></entry>

SQLite database.db exists, i just created one.

Also, i just added the file:
sqlite-jdbc-3.8.11.1.jar
into the /lib folder.

All seems to be ok, but when i run traccar.bat to test the connection, i receive this error:

java.lang.ClassNotFoundException: org.sqlite.JDBC

Could you tell me what is wrong ?

Thanks in advance,
David

Anton Tananaev9 years ago

Just putting driver JAR file into the lib folder is not enough. You need to make sure it's in the Java classpath.

You can try to put following line to the config file:

<entry key='database.driverFile'>C:\Archivos de programa\Traccar\lib\sqlite-jdbc-3.8.11.1.jar</entry>
David9 years ago

Thanks Anton,

I updated the config file and just now i receive this error message into an alertbox:

NullPointerException

Any ideas ?

Thanks again,
David

Anton Tananaev9 years ago

I guess there is something wrong with SQL queries.

One common problem is empty server table. Try to create a record there if it's empty.

David9 years ago

New error message:

[SQLITE_BUSY] The database file is locked (database is locked)

Thanks again,
David

Anton Tananaev9 years ago

SQLite is an embedded database, so you can access it only from a single process (there might be some ways around it). Looks like some other process is already using it.