Traccar 5.0 and Microsoft SQL Server

Gachkar3 years ago

Hi;
I am currently using version 4 of this software with a Microsoft SQL database. Will the change to the new version of this software cause a problem with the sql database ? I mean the structure of the database tables will change?

Thanks

Anton Tananaev3 years ago

There's one new column, but otherwise everything should work. Let us know if you experience any issues.

jay3 years ago

So is it best to create traccar db on mysql first on a new v5.0 install, and then restore the sql backup so the new c olumn is created as you stated.

Anton Tananaev3 years ago

Why would you do that? Traccar does migrations automatically, as I said.

jay3 years ago

So on a fresh install, just restore the backup, and start traccar service

Gachkara year ago

Dear Anton
I installed it but following messages in LOG file :

Main method error - Unable to make void jdk.internal.loader.ClassLoaders$AppClassLoader.appendToClassPathForInstrumentation(java.lang.String) accessible: module java.base does not "opens jdk.internal.loader" to unnamed module @6e4784bc - InaccessibleObjectException (... < DatabaseModule:56 < <gener:-1 < *:-1 < ... < MainModule:123 < ...)

2023-07-08 23:44:39  WARN: JNA: Callback org.traccar.WindowsService$ServiceMain@4ebff610 threw the following exception - Unable to make void jdk.internal.loader.ClassLoaders$AppClassLoader.appendToClassPathForInstrumentation(java.lang.String) accessible: module java.base does not "opens jdk.internal.loader" to unnamed module @6e4784bc - InaccessibleObjectException (... < DatabaseModule:56 < <gener:-1 < *:-1 < ... < MainModule:123 < ...)

TRACCAR.XML:

    <entry key='database.driverFile'>C:\enu\mssql-jdbc-12.2.0.jre8.jar</entry>
    <entry key='database.driver'>com.microsoft.sqlserver.jdbc.SQLServerDriver</entry>
    <entry key='database.url'>jdbc:sqlserver://x.x.x.x;user=traccarv5;password=xx;databaseName=traccarv5;</entry>
    <entry key='database.user'>traccar</entry>
    <entry key='database.password'>xx</entry>	
Anton Tananaeva year ago
Gachkara year ago

Dear Anton;
I am currently using V4 in another server with a following SQL Connection in traccar.xml file :

    <entry key='database.driver'>com.microsoft.sqlserver.jdbc.SQLServerDriver</entry>
    <entry key='database.url'>jdbc:sqlserver://188.XXX.XX.XX;user=sa;password=%%%%;databaseName=traccar;</entry>
    <entry key='database.user'>sa</entry>
    <entry key='database.password'>%%%%</entry>

now I need to use SQL database in another server that traccar v5 installed:

    <entry key='database.driver'>com.microsoft.sqlserver.jdbc.SQLServerDriver</entry>
    <entry key='database.url'>jdbc:sqlserver://188.XXX.XX.XX;user=sa;password=%%%%;databaseName=traccarv5;</entry>
    <entry key='database.user'>sa</entry>
    <entry key='database.password'>%%%%</entry>

but I see following errors in log file

2023-07-09 23:17:25  INFO: Starting server...
2023-07-09 23:17:25  INFO: HikariPool-1 - Starting...
2023-07-09 23:17:27 ERROR: HikariPool-1 - Exception during pool initialization. - unable to find valid certification path to requested target - SunCertPathBuilderException (... < DatabaseModule:79 < <gener:-1 < *:-1 < ... < MainModule:123 < ...)
2023-07-09 23:17:27 ERROR: Main method error - unable to find valid certification path to requested target - SunCertPathBuilderException (... < DatabaseModule:79 < <gener:-1 < *:-1 < ... < MainModule:123 < ...)
2023-07-09 23:17:27  WARN: JNA: Callback org.traccar.WindowsService$ServiceMain@4ebff610 threw the following exception - unable to find valid certification path to requested target - SunCertPathBuilderException (... < DatabaseModule:79 < <gener:-1 < *:-1 < ... < MainModule:123 < ...)
Anton Tananaeva year ago

Seems like you've ignored my link.

Gachkara year ago

Dear Anton
Thank you for your interestin.
I re-read the link you sent.
I added the following parameter to databse.url:
trustServerCertificate=true;
in version 4 the above parameter not need or I forgot it.
The Server started and new database created.
I prepared another server to first test version 5 with SQL, then switch to version 4.
I check for users and passwords tomorrow.

Best regards

Gachkara year ago

Dear Anton;
Hi
I tried to connect SQL server to over local physical server (V4). In this server PORT 1433 mapped to 57433 and I opened the port in V5 server I see the following error on Log file :

2023-07-10 21:57:40 ERROR: HikariPool-1 - Exception during pool initialization. - The connection to the host 185.xx.xx.xx, named instance xyzwin,57433 failed. Error: "java.net.SocketTimeoutException: Receive timed out". Verify the server and instance names and check that no firewall is blocking UDP traffic to port 1434. For SQL Server 2005 or later, verify that the SQL Server Browser Service is running on the host. - SQLServerException (... < DatabaseModule:79 < <gener:-1 < *:-1 < ... < MainModule:123 < ...)
2023-07-10 21:57:40 ERROR: Main method error - The connection to the host 185.xx.xx.xx, named instance xyzwin,57433 failed. Error: "java.net.SocketTimeoutException: Receive timed out". Verify the server and instance names and check that no firewall is blocking UDP traffic to port 1434. For SQL Server 2005 or later, verify that the SQL Server Browser Service is running on the host. - SQLServerException (... < DatabaseModule:79 < <gener:-1 < *:-1 < ... < MainModule:123 < ...)
2023-07-10 21:57:40  WARN: JNA: Callback org.traccar.WindowsService$ServiceMain@4ebff610 threw the following exception - The connection to the host 185.xx.xx.xx, named instance xyzwin,57433 failed. Error: "java.net.SocketTimeoutException: Receive timed out". Verify the server and instance names and check that no firewall is blocking UDP traffic to port 1434. For SQL Server 2005 or later, verify that the SQL Server Browser Service is running on the host. - SQLServerException (... < DatabaseModule:79 < <gener:-1 < *:-1 < ... < MainModule:123 < ...)

Connection information is :

    <entry key='database.driver'>com.microsoft.sqlserver.jdbc.SQLServerDriver</entry>
    <entry key='database.url'>jdbc:sqlserver://185.xx.xx.xx\XYZWIN,57433;Initial Catalog=traccarv5;Persist Security Info=True;User ID=sa;Password=xxxx;trustServerCertificate=true;</entry>
    <entry key='database.user'>sa</entry>
    <entry key='database.password'>xxxx</entry>	
Anton Tananaeva year ago

The URL doesn't look right. I would recommend reading the official MS documentation:

https://learn.microsoft.com/en-us/sql/connect/jdbc/building-the-connection-url

Gachkara year ago

Dear Anton;
Hi;
After the changes in the router ports, the user code and passwords got messed up and I had to reset the devices. Any way now the V5 is working with new database and no with old V4 database.

Thank you for your interesting