jdbc connection to database, password error?

Marco5 years ago

Hi,

I'm running traccar with the standard config files, which I've not touched.
When I open my traccar url with any browser, I can see all my tracks on the map, so the data are there.

However, I'm not able to open the database through a jdbc connection with Squirrel SQL.
I have two database files:

/opt/traccar/conf/database.mv.db (314M)
/opt/traccar/conf/database.trace.db (1.4M)

I can open either one with Squirrel SQL, with the connection string

jdbc:h2:/opt/traccar/data/database.[mv|trace].db

If I specify no user and no password to connect to the databases, I only see two schemas which do not contain any track data:
INFORMATION_SCHEMA
PUBLIC

If I connect with the "sa" user and no password, I get this error:

org.h2.jdbc.JdbcSQLInvalidAuthorizationSpecException: Wrong user name or password [28000-199]

My /opt/traccar/conf/traccar.xml, which I didn't alter, contains these lines:

<entry key='database.driver'>org.h2.Driver</entry>
<entry key='database.url'>jdbc:h2:./data/database</entry>
<entry key='database.user'>sa</entry>
<entry key='database.password'></entry>

Is there any password which I'm missing?

Thanks for any help, and for this beautiful piece of software. :-)

Anton Tananaev5 years ago
Marco5 years ago

Thanks Anton,

that's why I'm surprised by the "wrong password" error. I'm wondering wether it's a problemo of my client, Squirrel SQL. Has anybody seen this password error with Squirrel?

Thanks, Marco

Marco5 years ago

A few more info. I've created brand new traccar databases, restarting the application with no data. Before restarting, I edited /opt/traccar/conf/traccar.xml adding a password. Shutting down the application and opening the new databases with Squirrel using the new password, I still see no tracking data, but only the two schemas:
INFORMATION_SCHEMA
PUBLIC

So it's not a password issue.
Shouldn't I see a database schema containing the tracking data?

Thanks, Marco

Marco5 years ago

Still more info:

This is what I see if I open the database with the H2 java application: https://i.ibb.co/tsnPLDK/traccar-h2-db.png (png, 25 KiB)
The image is a screenshot of my browser at http://localhost:8082/login.do?jsessionid=f20e39... opening /opt/traccar/data/database.mv.db

So it's not a password issue and it's not a Squirrel SQL client issue. What else am I doing wrong?

Thanks, Marco

Anton Tananaev5 years ago

I see that you are opening /home/marco/download/... and not /opt/traccar/data/database.mv.db. The screenshot looks like an empty database, so you are definitely not opening the correct database file.

Marco5 years ago

Hi Anton,

I assure you that in /home/marco/download/ there's a copy of /opt/traccar/data/database.mv.db, downloaded locally from the traccar server after shutting down the traccar service. The file is 314 Mb, so it can't be an empty database. I just don't understand why I see only the INFORMATION_SCHEMA schema. There has to be another schema with the traccar data, right?

Thanks a lot, Marco

Anton Tananaev5 years ago

What's the URL you are using?

Marco5 years ago

Hi Anton, sorry for the long delay, if you mean the url of the browser when I open the h2 driver (h2-1.4.200.jar), it's
http://localhost:8082/login.do?jsessionid=3e947d2275111dd24b7230293bf1182c

Thanks, Marco

Anton Tananaev5 years ago

I mean database URL.

Marco5 years ago

Hi Anton, the production database doesn't have a public url. You can find a small test database here:
https://slash.dynu.com/db.test/
It worked perfectly on traccar for a few minutes, showing the position of a car on the map on the traccar web interface. Still no luck when I try to read the data through the h2 driver. User sa, password (void).

Thanks, Marco

Marco5 years ago

...in case you want to mount it on a traccar instance and look at it on the web interface, web user admin, password admin.

Bye, Marco

Anton Tananaev5 years ago

I think you misunderstood me. What is the JDBC URL you are using to connect to the database file?

Marco5 years ago

Sorry Anton,

it's jdbc:h2:/home/marco/download/database.mv.db
Screenshot: https://ibb.co/Pc7JWTZ

Thanks, Marco

Anton Tananaev5 years ago

Why is it not simply jdbc:h2:/home/marco/download/database?