Not starting with Postgresql 11

Tony Shelver5 years ago

Installed the linux Traccar 4.3 zip on Ubuntu 18.04. Works.
Edited the traccar.xml file to use Postgres. Not working.

Looked in /opt/traccar/logs/tracker.log:
logging for the h2 db,
but not a single entry when switching to Postgresql.
Switch back to h2, and it's logging again.

No other logging files in /opt/traccar.logs/

Edited traccar.xml as below

    <entry key='database.driver'>org.postgresql.Driver</entry>
    <entry key='database.url'>dbc:postgresql://localhost:5432/traccar</entry>
    <entry key='database.user'>uid</entry>
    <entry key='database.password'>pwde</entry>

The config default still points to

       <entry key='config.default'>./conf/default.xml</entry>

Didn't change anything here

Tested logging into the postgresql user / database from another app, works but not a jdbc connection).

Only thing I can think is that maybe need to have the Postgresql jdbc jar file loaded: possibly not included in traccar standard install?
But why no logging going on?

For the jarfile, I will need the target directory and the java version (8 or 7 or 6) as there are specific postgres drivers for each of those.
per https://jdbc.postgresql.org/download.html

Any suggestions would be greatly appreciated!

Tony Shelver5 years ago

Just to add to the above:
The only log file in /opt/traccar/logs is tracker-server.log.20190227 (and the one for yesterday of course).
There is no wrapper.log. I assume this is used once I connect devices.

Tony Shelver5 years ago

Adding to my investigations. The postgres jdbc driver (postgresql-42.2.5.jar) is in /opt/traccar/lib. So that doesn't seem to be the issue either.

Ernesto Vallejo5 years ago

I think you have misspelled "jdbc" in your database.url entry key. It only shows "dbc"
Could it be the problem?

Traccar 4.1 onwards no longer use service wrapper.

Tony Shelver5 years ago

I already tried jdbc before posting.... I found dbc and jdbc used in other driver configurations

The other big issue for me is why no logging at all is being generated in the logging file... I would at least expect to see a connection or jdbc interface / load error.

Ernesto Vallejo5 years ago

Maybe, as per this link try

<entry key='database.url'>jdbc:postgresql://127.0.0.1:5432/traccar</entry>

Instead of

<entry key='database.url'>jdbc:postgresql://localhost:5432/traccar</entry>
Anton Tananaev5 years ago

Localhost should work fine. I don't think that's a problem.

Ernesto Vallejo5 years ago

I mentioned it because once this happened to me. Hosts file was modified by another software and I was not aware of.
User privileges, maybe jdbc connection requires a different set of privileges that the other software that you used to test your database.
Maybe database is at another port. Double check it is at the correct port.
Running out of ideas.

Tony Shelver5 years ago

I also already tried the option mentioned above, replacing localhost with 127.0.0.1, in case the localhosts was an issue.

Ernesto's suggestion that maybe it has something to do with privileges is a possibility. I experimented with with MariaDB with similar results. I will raise in a new thread.