0
我正在嘗試使用準備好的語句和TABLE_CATALOG和TABLE_SCHEMA的參數來選擇默認模式'PUBLIC'中的所有表。當我創建一個準備好的語句時,我從系統中得到一個錯誤,並且沒有任何意義。如果我指定TABLE_CATALOG而不使用TABLE_SCHEMA,它可以完美地工作。另外,如果我指定TABLE_SCHEMA而沒有TABLE_CATALOG,它也可以正常工作。我在這裏做錯了什麼?H2 JDBC準備語句異常
SELECT
TABLE_CATALOG,
TABLE_SCHEMA,
TABLE_NAME
FROM INFORMATION_SCHEMA.TABLES
WHERE
TABLE_CATALOG = ?, TABLE_SCHEMA = ?
異常線程 「main」 org.h2.jdbc.JdbcSQLException:語法錯誤在SQL
statement "SELECT
TABLE_CATALOG,
TABLE_SCHEMA,
TABLE_NAME
FROM INFORMATION_SCHEMA.TABLES
WHERE
TABLE_CATALOG = ?,[*] TABLE_SCHEMA = ?"; SQL statement:
SELECT
TABLE_CATALOG,
TABLE_SCHEMA,
TABLE_NAME
FROM INFORMATION_SCHEMA.TABLES
WHERE
TABLE_CATALOG = ?, TABLE_SCHEMA = ? [42000-193]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:345)
at org.h2.message.DbException.get(DbException.java:179)
at org.h2.message.DbException.get(DbException.java:155)
at org.h2.message.DbException.getSyntaxError(DbException.java:191)
at org.h2.command.Parser.getSyntaxError(Parser.java:530)
at org.h2.command.Parser.prepareCommand(Parser.java:257)
at org.h2.engine.Session.prepareLocal(Session.java:561)
at org.h2.engine.Session.prepareCommand(Session.java:502)
at org.h2.jdbc.JdbcConnection.prepareCommand(JdbcConnection.java:1203)
at org.h2.jdbc.JdbcPreparedStatement.<init>(JdbcPreparedStatement.java:73)
at org.h2.jdbc.JdbcConnection.prepareStatement(JdbcConnection.java:287)
at com.zaxxer.hikari.pool.ProxyConnection.prepareStatement(ProxyConnection.java:310)
at com.zaxxer.hikari.pool.HikariProxyConnection.prepareStatement(HikariProxyConnection.java)
我只是意識到我忘了WHERE子句中的AND。 –