java.sql.SQLException: Unknown column 'LAST_INSERT_ID' in 'field list' at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2847) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1531) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1622) at com.mysql.jdbc.Connection.execSQL(Connection.java:2376) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265) at javax.servlet.http.HttpServlet.service(HttpServlet.java:803) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269) at
java.sql.SQLException: Unknown column 'LAST_INSERT_ID' in 'field list' at
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:691) at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:469) at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:403) at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301) at at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482) at javax.servlet.http.HttpServlet.service(HttpServlet.java:710) at
java.sql.SQLException: Unknown column 'LAST_INSERT_ID' in 'field list' at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:874) at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665) at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528) at
java.sql.SQLException: Unknown column 'LAST_INSERT_ID' in 'field list' at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689) at java.lang.Thread.run(Thread.java:595)
This kind of exception i.e " java.sql.SQLException: Unknown column 'LAST_INSERT_ID' in 'field list' " occurs because you are using a column name in your sql query for a particular table that you might have not created.
For Example :
Let have SELECT a query : -
SELECT NAME , BRANCH FROM STUDENT
NAME and BRANCH are two column in select query . This king of exception will occur if you are trying to use a column name that does not consist in table.
Solution Of Exception :
1) Remove the column name from your sql query.
2) Create the column with that name in the table name used in the query.
No comments:
Post a Comment