2016-01-20 485 views
0

我的SQL查询中没有任何“est”。我可以直接使用此SQL成功插入Vertica,但在使用JDBC时出错。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' ) ]

+0

你能否发布SQL导致这个错误? –

+0

java.sql.SQLException:[Vertica] [VJDBC](4856)错误:语法错误处于或接近“est”[insert into public.gamelive_original(小时,分钟,ip,国家,sp,行为,时间,uid,pcode ('21','40','125.90.93.219','hello',NULL,'webzb',NULL,'10240',r_name,r_owner,r_owne_id,r_category,online_num,ver,sender,msg,dt) ,'hello','hello','hello',NULL,'hello','6094',NULL,'yeschenshu','love','2016-01-17')] – Lina

+0

格式化并添加了来自评论到问题。 – JodyT

回答

4

你的堆栈跟踪指示批量更新 - 错误会在更新的行之一。

当你的日志显示参数SQL里面你可能不使用PreparedStatement

我最好的猜测:你丢失了一些代码中的逃逸,插入一个字符串像...

​​

没有哪适当的转义将创建一个SQL像

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

这将创建一个错误近“EST”