<entry key='database.driver'>com.mysql.cj.jdbc.Driver</entry>
<entry key='database.url'>jdbc:mysql://localhost/traccar?zeroDateTimeBehavior=round&serverTimezone=UTC&allowPublicKeyRetrieval=true&useSSL=false&allowMultiQueries=true&autoReconnect=true&useUnicode=yes&characterEncoding=UTF-8&sessionVariables=sql_mode=%27%27</entry>
<entry key='database.user'>[USER]</entry>
<entry key='database.password'>[PASSWORD]</entry>
Fixed & escaping. It was broken in a recent website update. It used to be escaped correctly.
By the way sql_mode='' doesn't need to be escaped. It's valid XML as is.
Hi Anton,
thanks for addressing this so quickly. We encountered this during a deployment and confirmed it was related to the documentation. Glad it's now fixed — it will save others quite some time.
Thanks again for your continued work on Traccar!
I follow all the described instructions for connecting to the mysql database, but the traccar server does not start.
Are you getting the same error?
All is ok. There was no error. I added a port to the code and the service started. .... <entry key='database.url'>jdbc:mysql://localhost:3306/traccar?zeroDate ............
Hello,
I noticed that the MySQL configuration example in the documentation uses a standard JDBC URL like:
However, when placing this inside traccar.xml, the server fails to start with:
SAXParseException (Config parsing error)
It seems the issue is that XML requires escaping special characters like "&", so the correct format should be:
&instead of:
&Also, for sessionVariables, using:
sql_mode=''breaks XML and must be encoded as:
sql_mode=%27%27So the working configuration becomes:
<entry key='database.url'> jdbc:mysql://localhost/traccar?zeroDateTimeBehavior=round&serverTimezone=UTC&allowPublicKeyRetrieval=true&useSSL=false&allowMultiQueries=true&autoReconnect=true&useUnicode=yes&characterEncoding=UTF-8&sessionVariables=sql_mode=%27%27 </entry>My question:
Would it be possible to update the documentation to reflect XML-safe configuration examples?
This could help avoid confusion for new installations.
Thanks!