ODBC Error

374 views
Skip to first unread message

Jeff Gunther

unread,
May 9, 2016, 12:57:09 AM5/9/16
to H2 Database
Hello. While testing a new connection with the PG ODBC driver (psqlodbc_09_05_0210-x64), I'm getting the following error with H2:

/**/Statement stat7 = conn2.createStatement();
2016-05-08 23:21:12 jdbc[4]:
/**/stat7.execute("set extra_float_digits to 2");
2016-05-08 23:21:12 jdbc[4]: exception
org.h2.jdbc.JdbcSQLException: Syntax error in SQL statement "SET EXTRA_FLOAT_DIGITS[*] TO 2 "; expected "@, AUTOCOMMIT, MVCC, EXCLUSIVE, IGNORECASE, PASSWORD, SALT, MODE, COMPRESS_LOB, DATABASE, COLLATION, BINARY_COLLATION, CLUSTER, DATABASE_EVENT_LISTENER, ALLOW_LITERALS, DEFAULT_TABLE_TYPE, CREATE, HSQLDB.DEFAULT_TABLE_TYPE, PAGE_STORE, CACHE_TYPE, FILE_LOCK, DB_CLOSE_ON_EXIT, AUTO_SERVER, AUTO_SERVER_PORT, AUTO_RECONNECT, ASSERT, ACCESS_MODE_DATA, OPEN_NEW, JMX, PAGE_SIZE, RECOVER, NAMES, SCHEMA, DATESTYLE, SEARCH_PATH, SCHEMA_SEARCH_PATH, JAVA_OBJECT_SERIALIZER, LOGSIZE, FOREIGN_KEY_CHECKS"; SQL statement:
set extra_float_digits to 2 [42001-191]
    at org.h2.message.DbException.getJdbcSQLException(DbException.java:345)
    at org.h2.message.DbException.getSyntaxError(DbException.java:205)
    at org.h2.command.Parser.getSyntaxError(Parser.java:537)
    at org.h2.command.Parser.parseSet(Parser.java:5200)
    at org.h2.command.Parser.parsePrepared(Parser.java:447)
    at org.h2.command.Parser.parse(Parser.java:317)
    at org.h2.command.Parser.parse(Parser.java:293)
    at org.h2.command.Parser.prepareCommand(Parser.java:254)
    at org.h2.engine.Session.prepareLocal(Session.java:560)
    at org.h2.engine.Session.prepareCommand(Session.java:501)
    at org.h2.jdbc.JdbcConnection.prepareCommand(JdbcConnection.java:1202)
    at org.h2.jdbc.JdbcStatement.executeInternal(JdbcStatement.java:170)
    at org.h2.jdbc.JdbcStatement.execute(JdbcStatement.java:158)
    at org.h2.server.pg.PgServerThread.process(PgServerThread.java:392)
    at org.h2.server.pg.PgServerThread.run(PgServerThread.java:90)
    at java.lang.Thread.run(Thread.java:745)
2016-05-08 23:21:12 jdbc[4]:
/**/stat7.close();

Any ideas?

Noel Grandin

unread,
May 9, 2016, 4:27:30 AM5/9/16
to h2-da...@googlegroups.com
I'm guessing that the latest driver calls more options that we don't support/emulate

You have are two options

(1) use an older driver, not sure what the last one was we supported
(2) update the code to support (probably just ignore) these new options

For option (2), take a look in the Parser class and grep for "postgres"
Reply all
Reply to author
Forward
0 new messages