It's not a secret anymore!
The moose likes JDBC and Relational Databases and the fly likes PreparedStatement Error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "PreparedStatement Error" Watch "PreparedStatement Error" New topic

PreparedStatement Error

karthik swamy
Ranch Hand

Joined: Mar 14, 2011
Posts: 42
hello everyone,
just view this SQL queryi.e
This is what i am getting from database :

then in jsp I am replacing like this :

then the query looks like this :

then i am binding it with prepareStatement

if i need to set String only for org_id then it works

but if then query comes like this:

then code the java code fails to work...

so please suggest me any solutions for this...

Thanks and regards,
Karthik Swamy
Roberto Perillo

Joined: Dec 28, 2007
Posts: 2271

Champ, since this is more related to JDBC, I'm moving this to the JDBC forum.

Cheers, Bob "John Lennon" Perillo
SCJP, SCWCD, SCJD, SCBCD - Daileon: A Tool for Enabling Domain Annotations
Martin Vajsar

Joined: Aug 22, 2010
Posts: 3733

Karthik, please TellTheDetails (see especially ItDoesntWorkIsUseless).

Post the exception you're experiencing, including stack trace. Or, if you're not getting an exception, describe the output the code generates and explain why is it wrong.
Paul Clapham

Joined: Oct 14, 2005
Posts: 19973

In that code with the cryptically-named variables "a" and "b", the value of "b" is always zero. Since you made it a variable, perhaps that wasn't what you intended.
I agree. Here's the link:
subject: PreparedStatement Error
jQuery in Action, 3rd edition