Ulf Dittmer wrote:Make sure none of the values you're about to insert is null. The most likely candidate seems "bb", but you should check all of them, either by adding logging statements, or by attaching a debugger.
Thanks for your reply. As you said, I have checked everything and none of them is being passed as null and this is what I got
java.sql.SQLException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'null(topic,question,a1,a2,a3,a4,hint_pic,date)values(null,null,null,null,null,nu' at line 1 am not able to figure it out please help.
ummm!! oh yeah i mean!! you are right..!! See how freaked I'm now.!! Please tell me. See I have checked all the parameters and have also compared with other similar type of code which is working. But still not able to find any issues. I'm posting my JSP page's code also. Please have a look for me.
posted 7 years ago
Some comments in no particular order:
The rs.beforeNext() statements in lines 32 and 47 of the JSP don't accomplish anything, and neither do the import statements in line 1 and 2.
You should not have Java code in JSPs - read up on the MVC pattern, and start implementing it.
You don't need to load the DB driver every time you make a DB call. In fact, you shouldn't. Move that code to a servlet context listener class.
You should close DB connections once you're done with them.
The likely problem is the fact that the file upload library alters the parameter handling, and you need to take a different approach. Search for "Process a regular form field" in http://commons.apache.org/proper/commons-fileupload/using.html.
But if that's the issue I'm confused - you said you checked that the parameters are getting to the server OK, right? So all the variables in lines 56-62 of the servlet had correct values, yes?