Win a copy of Java Database Connections & Transactions (e-book only) this week in the JDBC forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

problem in request.getparameter  RSS feed

 
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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


in second page


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 ]
 
Marshal
Posts: 24492
55
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI Paul

thank you

problem is solved

 
You guys wanna see my fabulous new place? Or do you wanna look at this tiny ad?
how do I do my own kindle-like thing - without amazon
https://coderanch.com/t/711421/engineering/kindle-amazon
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!