File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
A friendly place for programming greenhorns!
Big Moose Saloon
Search
|
Java FAQ
|
Recent Topics
Register / Login
JavaRanch
»
Java Forums
»
Databases
»
JDBC
Author
problem in request.getparameter
priya pratheepp
Ranch Hand
Joined: Apr 02, 2008
Posts: 59
posted
May 14, 2008 00:05:00
0
I have one table with field
EMP_ID varchar(10) latin1_swedish_ci PRI
I am passing the value of emp_id from one page to another.In the second page using request.getParameter i am receiving the value
first page
out.println("<td><a href = viewEmp.jsp?id=" + id + " /a>View</td>");
in second page
String tempQuery ="Select * from GSIS_EMP_MASTER where EMP_ID = "+ request.getParameter("id");
Above are working fine if the EMP_ID is integer.If it is not integer like 3sd or 1a... i am getting error of
Exception :
java.sql.SQLException
: Error during query: Unexpected Exception:
java.sql.SQLException
message given: Column not found: Unknown column '1a' in 'where clause'
thanks
[ May 14, 2008: Message edited by: priya pratheepp ]
Paul Clapham
Bartender
Joined: Oct 14, 2005
Posts: 16480
2
I like...
posted
May 14, 2008 10:15:00
0
If you print out your SQL command what do you see? My guess is this:
Select * from GSIS_EMP_MASTER where EMP_ID = 1a
This tells the database that you're comparing the column EMP_ID to the column 1a.
The short fix for that is to put the 1a into quotes. But don't do that. The correct fix is to use a
PreparedStatement
and call its setString() method.
priya pratheepp
Ranch Hand
Joined: Apr 02, 2008
Posts: 59
posted
May 15, 2008 00:16:00
0
HI Paul
thank you
problem is solved
I agree. Here's the link:
http://ej-technologies/jprofiler
- if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
subject: problem in request.getparameter
Similar Threads
Sending Email from jsp page
calling a java Script file into the Jsp
Problem in inserting data into access database through jsp file
reading data from jsp page to another jsp page using request.getParameter
How to store option format value in database in jsp
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter