Setting up new MySQL DB problem

Victor Butlera year ago

Hello,

I run into a strange issue - Traccar 5.10, trying to set a new MySQL database from scratch, I get the following error:

ERROR: Main method error - Table 'dbtest.tc_devices' doesn't exist - SQLSyntaxErrorException (... < QueryBuilder:469 < DatabaseStorage:115 < DeviceUtil:39 < ...)

Same configuration works with an existing database:

<entry key='database.driver'>com.mysql.cj.jdbc.Driver</entry>
<entry key='database.url'>jdbc:mysql://dbhost:3306/dbtest?serverTimezone=UTC&amp;useSSL=false&amp;allowMultiQueries=true&amp;autoReconnect=true&amp;useUnicode=yes&amp;characterEncoding=UTF-8&amp;sessionVariables=sql_mode=''</entry>
<entry key='database.user'>user</entry>
<entry key='database.password'>pass</entry>
Anton Tananaeva year ago

Looks like you have not initialized the schema. Probably you changed something in the configuration files that broke it.

Victor Butlera year ago

Thanks man! That was it!

Alaaudeen5 months ago
2024-08-05 21:23:33 DEBUG: validationTimeout...............5000
2024-08-05 21:23:33  INFO: HikariPool-1 - Starting...
2024-08-05 21:23:33 DEBUG: X509Certificate: Alg:{0}, Serial:{1}, Subject:{2}, Issuer:{3}, Key type:{4}, Length:{5,number,#}, Cert Id:{6,number,#}, Valid from:{7}, Valid until:{8}
2024-08-05 21:23:33 DEBUG: X509Certificate: Alg:{0}, Serial:{1}, Subject:{2}, Issuer:{3}, Key type:{4}, Length:{5,number,#}, Cert Id:{6,number,#}, Valid from:{7}, Valid until:{8}
2024-08-05 21:23:33 DEBUG: X509Certificate: Alg:{0}, Serial:{1}, Subject:{2}, Issuer:{3}, Key type:{4}, Length:{5,number,#}, Cert Id:{6,number,#}, Valid from:{7}, Valid until:{8}
2024-08-05 21:23:33 DEBUG: X509Certificate: Alg:{0}, Serial:{1}, Subject:{2}, Issuer:{3}, Key type:{4}, Length:{5,number,#}, Cert Id:{6,number,#}, Valid from:{7}, Valid until:{8}
2024-08-05 21:23:33 DEBUG: X509Certificate: Alg:{0}, Serial:{1}, Subject:{2}, Issuer:{3}, Key type:{4}, Length:{5,number,#}, Cert Id:{6,number,#}, Valid from:{7}, Valid until:{8}
2024-08-05 21:23:33 DEBUG: X509Certificate: Alg:{0}, Serial:{1}, Subject:{2}, Issuer:{3}, Key type:{4}, Length:{5,number,#}, Cert Id:{6,number,#}, Valid from:{7}, Valid until:{8}
2024-08-05 21:23:33 DEBUG: X509Certificate: Alg:{0}, Serial:{1}, Subject:{2}, Issuer:{3}, Key type:{4}, Length:{5,number,#}, Cert Id:{6,number,#}, Valid from:{7}, Valid until:{8}
2024-08-05 21:23:33 DEBUG:  TLSHandshake: {0}:{1,number,#}, {2}, {3}, {4,number,#}
2024-08-05 21:23:33  INFO: HikariPool-1 - Added connection com.mysql.cj.jdbc.ConnectionImpl@64030b91
2024-08-05 21:23:33  INFO: HikariPool-1 - Start completed.
2024-08-05 21:23:33 DEBUG:  TLSHandshake: {0}:{1,number,#}, {2}, {3}, {4,number,#}
2024-08-05 21:23:33 DEBUG: HikariPool-1 - Added connection com.mysql.cj.jdbc.ConnectionImpl@25fea42f
2024-08-05 21:23:33 ERROR: Main method error - Table 'vts.tc_devices' doesn't exist - SQLSyntaxErrorException (... < QueryBuilder:469 < DatabaseStorage:115 < DeviceUtil:39 < ...)

im also having same problem., i didnt know how to Looks like you have not initialized the schema

Anton Tananaev5 months ago

And you're using the latest official release without any code or config changes, apart from the database?

Alaaudeen5 months ago

im using Traccar version 5.7., mysql 5.7 ., Traccar configuration as

    <entry key='web.enable'>true</entry>
    <entry key='web.port'>8082</entry>
    <entry key='web.path'>/opt/traccar/web</entry>

    <entry key='geocoder.enable'>false</entry>
    <entry key='geocoder.type'>google</entry>

    <entry key='logger.enable'>true</entry> 
    <entry key='logger.level'>all</entry>
    <entry key='logger.file'>/opt/traccar/logs/tracker-server.log</entry>

    <!-- DATABASE CONFIG -->

    <entry key='database.driver'>com.mysql.cj.jdbc.Driver</entry>

    <entry key='database.url'>jdbc:mysql://localhost/vts?allowMultiQueries=true&amp;autoReconnect=true&amp;useUnicode=yes&amp;characterEncoding=UTF-8&amp;sessionVariables=sql_mode=ANSI_QUOTES</entry>
    <entry key='database.user'>root</entry>
    <entry key='database.password'>Mstracker@123</entry>

    <entry key='forward.enable'>true</entry>
    <entry key='forward.url'>http://104.237.9.130/cgs_new/telnet/9501/index.php?data={uniqueId},{latitude},{longitude},{fixTime},{speed},{course},{valid},{attributes}</entry>	


    <entry key='database.selectDevicesAll'>
        select id, '' as name, device_id as uniqueid from assests_master where status=1;
    </entry>

followed by devices ports

Anton Tananaev5 months ago

Then I recommend upgrading first and using default configuration parameters.