Vertica JDBC 错误

Vertica JDBC wrong

我的 SQL 查询中没有任何 "est"。我可以直接用这个SQL成功插入vertica,但是用JDBC.

就出错了

java.sql.SQLException: [Vertica]VJDBC ERROR: Syntax error at or near "est" [ insert into .... ]

Caused by: java.sql.SQLException: [Vertica]VJDBC ERROR: Syntax error at or near "est" at com.vertica.util.ServerErrorData.buildException(Unknown Source) at com.vertica.dataengine.VDataEngine.prepareImpl(Unknown Source) at com.vertica.dataengine.VDataEngine.prepareBatch(Unknown Source) at com.vertica.dataengine.VDataEngine.prepareBatch(Unknown Source) at com.vertica.jdbc.SStatement.executeBatch(Unknown Source) at com.lina.common.util.JdbcConn.executeBatchUpdate(JdbcConn.java:77)

整个查询的错误:

java.sql.SQLException: [Vertica]VJDBC ERROR: Syntax error at or near "est" [ insert into public.gamelive_original(hour, minute, ip, country, sp, act, time, uid, pcode, r_name, r_owner, r_owne_id, r_category, online_num, ver,sender,msg,dt) values ( '21','40','125.90.93.219','hello',NULL,'webzb',NULL,'10240','hello','hello','hel‌​lo',NULL,'hello','6094',NULL,'yeschenshu','love','2016-01-17' ) ]

您的堆栈跟踪指示 批处理 更新 - 错误将出现在更新的行之一中。

由于您的日志显示 SQL 中的参数,您可能没有使用 PreparedStatement

我的最佳猜测:您的代码中缺少转义并插入一个字符串,例如...

  "C'est la vie"

如果不进行适当的转义,将会创建一个 Sql 类似

  insert into foo(bar) values('C'est la vie')

这会在 "est"

附近产生错误