简体   繁体   中英

Tomcat6 MySQL Unknown column in 'field list'"

I'm working in a RedHat with Tomcat6 and MySQL, and i'll apreciate your help with a problem, i have a servlet connected to my DB , well, I send a sql "String" to my servlet and the servlet executes this code, i'm printing my sql string, something like this

"INSERT INTO xsn_core_helix_streams_stats (timestamp,type,client,publish_time,connects,id_stream,server) VALUES('2013/02/11 16:23:27',null,null,null,'1','4',6);" 

but i have receiving an Exception

 "java.sql.SQLException: Unknown column 'server' in 'field list'"

and when i describe my table , i can see the column , and when i copy and paste in the console , i can see "Query OK, 1 row affected (0.03 sec)" Why?

Despite the responses from @paulsm4 and @ilopezluna, SERVER is not a reserved word in MySQL. Cf. http://dev.mysql.com/doc/refman/5.5/en/reserved-words.html

I would therefore double-check that your table xsn_core_helix_streams_stats actually has a column named server .

For instance, try opening the MySQL client, ready the database, and run SHOW CREATE TABLE LIKE xsn_core_helix_streams_stats .

I can reproduce the error you report by creating a table without a column named server , and attempting the INSERT statement in your example.

My workbench mark the word "server", so maybe is a reserved word. Try to change the name of column in your table and query and try again

我解决了这个问题,tomcat6备份了我的servlet配置文件(Servlet / META-INF / context.xml),并将其放置在/ etc / tomcat6 / Catalina / localhost中,那么问题是该文件不正确,致谢,谢谢! !

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM