jQuery in Action, 2nd edition*
The moose likes JDBC and the fly likes escape character using prepared statement. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "escape character using prepared statement." Watch "escape character using prepared statement." New topic
Author

escape character using prepared statement.

Varun Khanna
Ranch Hand

Joined: May 30, 2002
Posts: 1400
Hi,
I m using a sybase database and type-4 driver.I have read that using prepared statement we don't need to use the escape character as prepareStatement put it internally but i do face a problem with single quote (')..though i m using prepared statement only.
Can anyone help me in this.


- Varun
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

It might be something the driver isn't doing correctly, but usually you don't have to worry about single quotes in PreparedStatements - they just get looked after.
Did you want to post a small snippet of code to show your population of data?
Varun Khanna
Ranch Hand

Joined: May 30, 2002
Posts: 1400
Thanks David I have got the point where i was making error.
I just want to know can i set a "text" field by using setXXX() method of JDBC ( like setInt(),setLong() or setObject() ) ?we don't have any method like setText() or we have to use raw SQL string if we have datafield column as "text" in db ??
Thnx.
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

you can't use setString() ?
Varun Khanna
Ranch Hand

Joined: May 30, 2002
Posts: 1400
Thanks its working now.I jus made things complicated.;-)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: escape character using prepared statement.
 
Similar Threads
Escaping special characters
Escape Character Help
how to write select query when where condition contains ampersand symbol(&)?
dealing with ' -- an apostrophe
Urgent Java interview question 6+ yrs exp.