H2 to SQL database problem

giorgijag6 years ago

Hi,

I want to add many devices to traccar windows local server on my laptop, so decided to use SQL databases (not H2).

in Traccar config file removed H2 code and wrote this for SQL:

<entry key='database.driver'>com.mysql.jdbc.Driver</entry> 
<entry key='database.url'>jdbc:mysql://localhost:3306/traccar?useSSL=false&amp;allowMultiQueries=true&amp;autoReconnect=true&amp;useUnicode=yes&amp;characterEncoding=UTF-8&amp;sessionVariables=sql_mode=''</entry>
<entry key='database.user'>root</entry> 
<entry key='database.password'>88888888</entry>

but localhost:8082 is unreachable.

Description text

Error log:

2019-01-22 00:27:19  INFO: HikariPool-1 - Starting...
2019-01-22 00:27:25 ERROR: HikariPool-1 - Exception during pool initialization. - Could not create connection to database server. Attempted reconnect 3 times. Giving up. - MySQLNonTransientConnectionException (... < DataManager:139 < *:89 < Context:382 < Main:110 < ...)
2019-01-22 00:27:25 ERROR: Main method error - Failed to initialize pool: Could not create connection to database server. Attempted reconnect 3 times. Giving up. - PoolInitializationException (... < DataManager:139 < *:89 < Context:382 < Main:110 < ...)
Anton Tananaev6 years ago

Is network connection enabled in MySQL config?

giorgijag6 years ago

SOLVED!

created user with "%" privileges and made succesfull connection.

Description text

log:

2019-01-22 23:04:54  INFO: HikariPool-1 - Starting...
2019-01-22 23:04:55  INFO: HikariPool-1 - Start completed.
2019-01-22 23:04:56  INFO: Clearing database change log checksums
2019-01-22 23:04:56  INFO: SELECT COUNT(*) FROM traccar.DATABASECHANGELOGLOCK
2019-01-22 23:04:56  INFO: CREATE TABLE traccar.DATABASECHANGELOGLOCK (ID INT NOT NULL, `LOCKED` BIT(1) NOT NULL, LOCKGRANTED datetime NULL, LOCKEDBY VARCHAR(255) NULL, CONSTRAINT PK_DATABASECHANGELOGLOCK PRIMARY KEY (ID))
2019-01-22 23:04:56  INFO: SELECT COUNT(*) FROM traccar.DATABASECHANGELOGLOCK
2019-01-22 23:04:56  INFO: DELETE FROM traccar.DATABASECHANGELOGLOCK
2019-01-22 23:04:56  INFO: INSERT INTO traccar.DATABASECHANGELOGLOCK (ID, `LOCKED`) VALUES (1, 0)
2019-01-22 23:04:56  INFO: SELECT `LOCKED` FROM traccar.DATABASECHANGELOGLOCK WHERE ID=1
2019-01-22 23:04:56  INFO: Successfully acquired change log lock 
........
jacob6 years ago

hello, Ive got other question about H2 to MySQL; it's possible to migrate only device's from h2 database (file database.db) to new empty database MySQL, or migrate/convert everything with history possitions. I make open old database in H2 but don't now how do this, generate script or something. I have now start Traccar 4.13 on MySQL, works fine. If not possible i must add every device again. Thanks for HELP and information.