This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Customer Requirements for Developers and have Marcho Behler on-line!
See this thread for details.
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


Win a copy of Customer Requirements for Developers this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "PreparedStatement Error" Watch "PreparedStatement Error" New topic
Author

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
Bartender

Joined: Dec 28, 2007
Posts: 2270
    
    3

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
Sheriff

Joined: Aug 22, 2010
Posts: 3717
    
  61

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
Sheriff

Joined: Oct 14, 2005
Posts: 19693
    
  10

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: http://aspose.com/file-tools
 
subject: PreparedStatement Error
 
It's not a secret anymore!