No connect Managed DataBase Digital Ocean

Ricardo 5 years ago

Hi I'm new here. I want to connect Traccar to a Digital Ocean managed database, but I cannot connect. Here the log. Is it possible to help me please?

2021-03-14 05:40:04  INFO: HikariPool-1 - Starting...
2021-03-14 05:40:08  INFO: HikariPool-1 - Start completed.
2021-03-14 05:40:11  INFO: Clearing database change log checksums
2021-03-14 05:40:11  INFO: SELECT COUNT(*) FROM traccar.DATABASECHANGELOGLOCK
2021-03-14 05:40:11  INFO: SELECT COUNT(*) FROM traccar.DATABASECHANGELOGLOCK
2021-03-14 05:40:11  INFO: SELECT `LOCKED FROM traccar.DATABASECHANGELOGLOCK WHERE ID=1
2021-03-14 05:40:11  INFO: Successfully acquired change log lock
2021-03-14 05:40:11  INFO: Creating database history table with name: traccar.DATABASECHANGELOG
2021-03-14 05:40:12  INFO: CREATE TABLE traccar.DATABASECHANGELOG (ID VARCHAR(255) NOT NULL, AUTHOR VARCHAR(255) NOT NULL, FILENAME VARCHAR(255) NOT NULL, DATEEXECUTED>2021-03-14 05:40:12  INFO: Successfully released change log lock
2021-03-14 05:40:12 ERROR: Main method error -
liquibase.exception.DatabaseException: Unable to create or change a table without a primary key, when the system variable 'sql_require_primary_key' is set. Add a prima>        at liquibase.executor.jvm.JdbcExecutor$ExecuteStatementCallback.doInStatement(JdbcExecutor.java:430)
        at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:87)
        at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:159)
        at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:139)
        at liquibase.changelog.StandardChangeLogHistoryService.init(StandardChangeLogHistoryService.java:284)
        at liquibase.Liquibase.checkLiquibaseTables(Liquibase.java:1172)
        at liquibase.Liquibase.clearCheckSums(Liquibase.java:1398)
        at org.traccar.database.DataManager.initDatabaseSchema(DataManager.java:310)
        at org.traccar.database.DataManager.<init>(DataManager.java:90)
        at org.traccar.Context.init(Context.java:292)
        at org.traccar.Main.run(Main.java:137)
        at org.traccar.Main.main(Main.java:110)
Caused by: java.sql.SQLException: Unable to create or change a table without a primary key, when the system variable 'sql_require_primary_key' is set. Add a primary ke>        at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:129)
        at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97)
        at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122)
        at com.mysql.cj.jdbc.StatementImpl.executeInternal(StatementImpl.java:764)
        at com.mysql.cj.jdbc.StatementImpl.execute(StatementImpl.java:648)
        at liquibase.executor.jvm.JdbcExecutor$ExecuteStatementCallback.doInStatement(JdbcExecutor.java:426)
        ... 11 more
Ricardo 5 years ago

Any help please? I need to know if anyone has the experience of configuring mysql with Digital Ocean managed databases, and if they have encountered this problem and if it has been fixed.

NanaYaw 4 years ago

i faced the same issue to resolve this you can try the 4 options

  1. Contact digital Ocean support to disable sql_require_primary_key
  2. Use default embedded H2 database.
  3. You can try other database traccar supports like postgres
  4. Set the required primary key in table.