| | |
Please help with JSP mysql update query
Please support our JSP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
•
•
The code you have written is correct... but java is a case sensitive language so might be there is some problem with the case..
check it carefully
JSP Syntax (Toggle Plain Text)
int UQ=statement.executeUpdate("insert into questions (qid, question, answer, subject) values ('," + questionin + "," + answerin + "," + subjectin + ")");
All this would not be a problem if the OP would two things that she should always do, and should have done from the beginning (but she probably learned from tutorials on roseindia, they love pushing this dope), which are:
1) Use a PreparedStatement. Do not cobble together a Statement like this. It is error prone in the coding, error prone in the execution (what happens if one of the variables contains a quote (') itself), and wide open to SQL injection attacks.
2) Don't use scriplets. They only still exist for backwards compatability and it is strongly reccommended not to use them anymore.
Last edited by masijade; May 28th, 2008 at 9:31 am.
Java Programmer and Sun Systems Administrator
----------------------------------------------
Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
----------------------------------------------
Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
![]() |
Similar Threads
- mysql UPDATE not working! Why? (PHP)
- connecting jsp with mysql database (JSP)
- Error while trying the update query (ASP)
Other Threads in the JSP Forum
- Previous Thread: Add month in date
- Next Thread: HTTP Status 405 - HTTP method GET is not supported by this URL
| Thread Tools | Search this Thread |
apache array backbutton combobox comma connection csv database development directorystructure dropdownlist dynamicpagetitles eclipse frames glassfish ie8 imagetodatabse imageupload integer internet java javaee javascript jsf jsp jsppagetitles levels mvc2 mvcmodel2 mysql netbeans network parameters passing ping printinserverinsteadofclient read redirect request.getparameter response seperated servlet servletdopost()readxml sessions software sql ssl state_saving_method stocks sun tomcat tutorial update values video web write






