aspose file tools
The moose likes JDBC and the fly likes Escaping special characters Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Databases » JDBC
Reply Bookmark "Escaping special characters" Watch "Escaping special characters" New topic
Author

Escaping special characters

Gopi Chand Maddula
Ranch Hand

Joined: May 11, 2010
Posts: 40

Hi JavaRanch,

I had a problem inserting my customer details in database. I have to insert customer into database as a column.
but i am facing a problem facing some values(for example: Queen's Court.),
Here my problem is inserting this value into database is not possible which should be done as it is.

Can any one please suggest me to overcome this problem in my java code.

Thanks in Advance...!
Raj S Kumar
Ranch Hand

Joined: Aug 06, 2006
Posts: 48
Hi Gopi,
Please try this issue in the JDBC forum. You could get answers from there as it is specific to JDBC.


Raj S Kumar
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19216

Moving there.


SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
Gopi Chand Maddula
Ranch Hand

Joined: May 11, 2010
Posts: 40

Hi Raj,

Thanks for Reply,

But i need to escape the bad characters in string before inserting into database.
so that i can use that code for verifying some other conditions also....!

Is it possible....?
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

SQL escape it, or use a prepared statement?
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 26173
    
  66

Gopi,
I recomment using a prepared statement unless you have a really good reason not to. It takes care of escaping such values for you when you call stmt.setString().


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
I agree. Here's the link: http://jrebel.com/download
 
subject: Escaping special characters
 
Similar Threads
two actions from one page
Auto increment key in Hibernate
Problem facing with executebatch function
not able to insert values in ms access database
Arabic Digits Encoding