• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Escaping special characters

 
Gopi Chand Maddula
Ranch Hand
Posts: 41
Eclipse IDE Firefox Browser
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Gopi,
Please try this issue in the JDBC forum. You could get answers from there as it is specific to JDBC.
 
Rob Spoor
Sheriff
Pie
Posts: 20545
56
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving there.
 
Gopi Chand Maddula
Ranch Hand
Posts: 41
Eclipse IDE Firefox Browser
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
SQL escape it, or use a prepared statement?
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34656
366
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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().
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic