Thanks, Evgenij

With H2 version *2.1.214* and the JDBC URL 
*jdbc:h2:tcp://localhost/MY_DB;AUTO_SERVER=TRUE;IGNORECASE=TRUE;NON_KEYWORDS=INTERVAL,VALUES*
I get this Exception:

Caused by: org.h2.jdbc.JdbcSQLNonTransientConnectionException: Unsupported 
connection setting "NON_KEYWORDS" [90113-200]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:622)
at org.h2.message.DbException.getJdbcSQLException(DbException.java:429)
at org.h2.message.DbException.get(DbException.java:205)
at org.h2.message.DbException.get(DbException.java:181)
at org.h2.engine.ConnectionInfo.readSettingsFromURL(ConnectionInfo.java:269)
at org.h2.engine.ConnectionInfo.<init>(ConnectionInfo.java:78)
at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:152)
at org.h2.Driver.connect(Driver.java:69)

However, I can set the parameter NON_KEYWORDS it in a H2 DB Session, see 
below.

I start H2 over TCP with this:

    java -cp /opt/h2-2.1.214/bin/h2-2.1.214.jar org.h2.tools.Server 
-baseDir $HOME/my_db -ifNotExists -tcp -tcpAllowOthers -tcpPort 9092 
1>my_db.log 2>&1

Then I run an init script, before connecting the server application, like 
this:

    java -cp /opt/h2-2.1.214/bin/h2-2.1.214.jar org.h2.tools.RunScript -url 
jdbc:h2:tcp://localhost/MY_DB -user SOMEUSER -password SOMEPASSWORD 
-showResults -script h2-init.sql

The content of h2-init.sql is:

SET AUTOCOMMIT             TRUE;
SET AUTO_SERVER            TRUE;
SET DB_CLOSE_DELAY         -1;
SET IGNORECASE             TRUE;
SET MODE                   ORACLE;
SET NON_KEYWORDS           INTERVAL, VALUES;
SET OLD_INFORMATION_SCHEMA TRUE;

CREATE USER   IF NOT EXISTS "BACKEND_USER"  PASSWORD 'secret' ADMIN;
CREATE USER   IF NOT EXISTS "FRONTEND_USER" PASSWORD 'secret' ADMIN;

CREATE SCHEMA IF NOT EXISTS BACKEND_SCHEMA  AUTHORIZATION "BACKEND_USER";
CREATE SCHEMA IF NOT EXISTS FRONTEND_SCHEMA AUTHORIZATION "FRONTEND_USER";

SELECT * FROM INFORMATION_SCHEMA.USERS;


I get the impression "NON_KEYWORDS" is only supported in a DB session, not 
as JDBC connection parameter.


Regards,
--
Carlo



On Sunday, July 2, 2023 at 6:10:24 AM UTC+2 Evgenij Ryazanov wrote:

> Hello!
>
> You need to quote column names in your application, there is nothing to do 
> on H2 side. If you use Hibernate ORM, you can force quotation of all 
> identifiers with hibernate.globally_quoted_identifiers setting.
>
> In the worst case you can add ;NON_KEYWORDS=INTERVAL to JDBC URL, but 
> this setting doesn't cover all possible cases and it should be considered 
> only as a possible temporary workaround.
>

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/h2-database/e4964c07-fe26-4569-a079-9a23cce280ean%40googlegroups.com.

Reply via email to