Hi there,
I�m having a problem with a
servlet I�m developing and hope that someone can point out what I think must be a small error in my code.
The following details are most likely irrelevant, but�I�m using JDeveloper and its embedded OC4J server on Windows XP.
OK, here�s my problem:
I have successfully connected my servlet to my Oracle database (running on the same machine) and can use (hardwired into my
Java) SQL SELECT and INSERT statements successfully also. I am trying to use HTML forms as my front end, the servlet as middleware and the Oracle database as my back end. I have successfully coded my HTML forms so that the servlet can accept user input via the forms.
However, my problem arises when I try to use an INSERT statement in my servlet which is supposed to take input from my HTML forms and insert it into my database: the code compiles fine and as I mentioned before, if I hardwire values for the insert statement into my servlet code, it works. I get a SQL Exception ORA-01722: invalid number when my insert statement is coded to take data given to it by my forms, code snippet below (all within a doGet method.
The code that works:
ResultSet result = null;
result = stmnt.executeQuery("SELECT * FROM tbl_experiment");
�etc
The code that doesn�t work:
int updateResult = 0;
// Declare Java variables that hold HTML forms input
String formForename = request.getParameter("Form_Forename");
String formIDNo = request.getParameter("Form_ID_No");
String formCountry = request.getParameter("Form_Country");
// this works when the values are hard-wired
// Execute an SQL update:
updateResult = stmnt.executeUpdate("INSERT INTO tbl_prototype (Forename, ID_No, Country)" +
"VALUES ('formForename', 'formIDNo', 'formCountry')" );
Many thanks to anyone who can help � this has been driving me crazy!!
Gillian Klee