1 回答

TA貢獻1802條經驗 獲得超6個贊
以下是使用普通 JDBC 重現它的方法:
如何重現它
使用此表
CREATE TABLE T (
? ID NUMBER(7),
? CONSTRAINT pk PRIMARY KEY (ID)
);
在內部使用Connection.prepareStatement(String, String[])重載,例如 jOOQ 所做的:
try (Connection c = dbSetup.getConnection()) {
? ? try (PreparedStatement s = c.prepareStatement(
? ? ? ? "insert into \"TEST\".\"T\" (\"ID\") values (?)", new String[] { "ID" })) {
? ? ? ? s.setInt(1, 1);
? ? ? ? s.execute ();
? ? }
}
解決方法
不要引用架構名稱:
try (Connection c = dbSetup.getConnection()) {
? ? try (PreparedStatement s = c.prepareStatement(
? ? ? ? "insert into TEST.\"T\" (\"ID\") values (?)", new String[] { "ID" })) {
? ? ? ? s.setInt(1, 1);
? ? ? ? s.execute ();
? ? }
}
完全避免資格:
try (Connection c = dbSetup.getConnection()) {
? ? try (PreparedStatement s = c.prepareStatement(
? ? ? ? "insert into \"T\" (\"ID\") values (?)", new String[] { "ID" })) {
? ? ? ? s.setInt(1, 1);
? ? ? ? s.execute ();
? ? }
}
使用 jOOQ 中的解決方法:
您可以使用關閉模式限定
Settings.renderSchema
您可以使用關閉標識符的引用
Settings.renderQuotedNames
添加回答
舉報