Traccar with MySQL in XAMPP

RickOShay9 years ago

Hello,

I am using the MySQL within XAMPP. I have configured traccar to work and it functions just fine using the H2 database. I have followed the instructions on changing modifiying the code to work with MySQL (https://www.traccar.org/mysql/); however, I cannot get the the program to communicate with the MySQL Database.

After I changed the code I rebooted and checked the traccar log file. I can see traccar shutdown and then try to comeback online, but from there, no more data is logged:


2015-08-11 21:21:49  INFO: Shutting down server...
2015-08-11 21:23:27  INFO: Operating System name: Windows 7 version: 6.1 architecture: amd64
2015-08-11 21:23:27  INFO: Java Runtime name: Java HotSpot(TM) 64-Bit Server VM vendor: Oracle Corporation version: 25.51-b03
2015-08-11 21:23:27  INFO: Memory Limit heap: 1820mb non-heap: 0mb
2015-08-11 21:23:27  INFO: Version: 3.1-SNAPSHOT
2015-08-11 21:24:01  INFO: Starting server...

Can anyone give me some ideas? Anyone work to traccar and xampp together?

Thanks

RickOShay9 years ago

After rebooting traccar still works, but it seems to still be writting data to the H2 database, with no communication to MySQL...

RickOShay9 years ago

Here is what my traccar config file looks like if this helps. I am still stuck. Do I have the ANSI code in an ok spot?


<?xml version='1.0' encoding='UTF-8'?>

<!DOCTYPE properties SYSTEM 'http://java.sun.com/dtd/properties.dtd'>

SET GLOBAL SQL_MODE=ANSI_QUOTES;

<properties>

...
Anton Tananaev9 years ago

No. You need to set mode to ANSI_QUOTES in MySQL config file (if you want it permanent) or via MySQL client (for current session only). It's part of MySQL config, not Traccar.

RickOShay9 years ago

Thank you. I have updated the my.ini file to reflect as follows below; however, when I go to XXX.XXX.XXX.XXX:8082 it won't load traccar and communicate with the MySQL database, it seems to work fine with the H2 database though. Any suggestions?


# The MySQL server
[mysqld]
SET GLOBAL SQL_MODE=ANSI_QUOTES;
port= 3306
socket = "C:/xampp/mysql/mysql.sock"
basedir = "C:/xampp/mysql" 
tmpdir = "C:/xampp/tmp" 
datadir = "C:/xampp/mysql/data"
pid_file = "mysql.pid"
# enable-named-pipe
key_buffer = 16M
max_allowed_packet = 1M
sort_buffer_size = 512K
net_buffer_length = 8K
read_buffer_size = 256K
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 8M
log_error = "mysql_error.log"

Anton Tananaev9 years ago

If you put it into the MySQL config file, you need to use following syntax:

sql-mode="ANSI_QUOTES"
RickOShay9 years ago

Thank you man! It works now!

sedoc0019 years ago

Hi RickOShay can you help me? I'm trying to septup traccar with mysql and xampp, but i'm stuck at the beginning.

Anton Tananaev9 years ago

@sedoc001, why do you want to use XAMPP? Only for MySQL?

RickOShay9 years ago

Hi,

Can you be more specific? What are you stuck on?

How to know H2 database in Traccar using command line in Linux ?
I've tried but it doesn't work

Thank you

Anton Tananaev9 years ago

Do you mean that you want to connect from command line to the database?

I don't know if there is any command line client available. Also, even if you find one, you would have to stop Traccar service stop because H2 doesn't allow connection from two different processes simultaneously.

So how to know H2 database in Traccar ?
How to get it ?

Anton Tananaev9 years ago

JDBC URL to the database is in the config file.

How to know it if I use Linux Server ?