eclipse-cdo / cdo

Eclipse Public License 1.0
3 stars 6 forks source link

SQL database settings: disable quoted column names for certain database types #81

Open Sat-Ing opened 2 days ago

Sat-Ing commented 2 days ago

With #19 , there was a change which quotes all database related names. There is a setting which can disable this feature: -Dorg.eclipse.net4j.db.DISABLE_QUOTED_NAMES=true

We need to use this setting for a MariaDB 10.2.6. I assume that this also applies for MySQL. Would it be possible to disable quoting by default for the MySQL adapter? New users would appreciate this for sure.

estepper commented 2 days ago

I guess that would be possible (not checked, yet). But before investigating further I'd like to understand why you need to disable it. Can you explain please?

Sat-Ing commented 1 day ago

Without this setting, the CDO repository cannot be initialized in my case. This is with CDO version 2024-06 for a freshly created repository:

org.eclipse.net4j.util.lifecycle.LifecycleException: java.sql.SQLSyntaxErrorException: (conn=58) You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '"cdo_properties" WHERE "name"='org.eclipse.emf.cdo.server.db.schemaVersion'' at line 1
    at org.eclipse.net4j.util.lifecycle.Lifecycle.internalActivate(Lifecycle.java:111)
    at org.eclipse.net4j.util.lifecycle.Lifecycle.activate(Lifecycle.java:202)
    at org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(LifecycleUtil.java:146)
    at org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(LifecycleUtil.java:136)
    at org.eclipse.emf.cdo.internal.server.Repository.doActivate(Repository.java:2845)
    at org.eclipse.net4j.util.lifecycle.Lifecycle.internalActivate(Lifecycle.java:83)
    at org.eclipse.net4j.util.lifecycle.ShareableLifecycle.internalActivate(ShareableLifecycle.java:43)
    at org.eclipse.net4j.util.lifecycle.Lifecycle.activate(Lifecycle.java:202)
    at org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(LifecycleUtil.java:146)
    at org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(LifecycleUtil.java:136)
    at org.eclipse.emf.cdo.server.CDOServerUtil.addRepository(CDOServerUtil.java:327)
    (my code)
Caused by: java.sql.SQLSyntaxErrorException: (conn=58) You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '"cdo_properties" WHERE "name"='org.eclipse.emf.cdo.server.db.schemaVersion'' at line 1
    at org.mariadb.jdbc.internal.util.exceptions.ExceptionFactory.createException(ExceptionFactory.java:62)
    at org.mariadb.jdbc.internal.util.exceptions.ExceptionFactory.create(ExceptionFactory.java:158)
    at org.mariadb.jdbc.MariaDbStatement.executeExceptionEpilogue(MariaDbStatement.java:262)
    at org.mariadb.jdbc.MariaDbStatement.executeInternal(MariaDbStatement.java:362)
    at org.mariadb.jdbc.MariaDbStatement.executeQuery(MariaDbStatement.java:611)
    at org.eclipse.emf.cdo.server.internal.db.DBStore.selectSchemaVersion(DBStore.java:1060)
    at org.eclipse.emf.cdo.server.internal.db.DBStore.doActivate(DBStore.java:681)
    at org.eclipse.net4j.util.lifecycle.Lifecycle.internalActivate(Lifecycle.java:83)
    ... 50 more
Caused by: org.mariadb.jdbc.internal.util.exceptions.MariaDbSqlException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '"cdo_properties" WHERE "name"='org.eclipse.emf.cdo.server.db.schemaVersion'' at line 1
    at org.mariadb.jdbc.internal.util.exceptions.MariaDbSqlException.of(MariaDbSqlException.java:34)
    at org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol.exceptionWithQuery(AbstractQueryProtocol.java:194)
    at org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol.executeQuery(AbstractQueryProtocol.java:262)
    at org.mariadb.jdbc.MariaDbStatement.executeInternal(MariaDbStatement.java:356)
    ... 54 more
Caused by: java.sql.SQLException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '"cdo_properties" WHERE "name"='org.eclipse.emf.cdo.server.db.schemaVersion'' at line 1
    at org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol.readErrorPacket(AbstractQueryProtocol.java:1695)
    at org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol.readPacket(AbstractQueryProtocol.java:1557)
    at org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol.getResult(AbstractQueryProtocol.java:1520)
    at org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol.executeQuery(AbstractQueryProtocol.java:256)
    ... 55 more