File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes Storing special characters(') into oracle Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Storing special characters( Watch "Storing special characters( New topic
Author

Storing special characters(') into oracle

Praveena Modugula
Greenhorn

Joined: Apr 21, 2006
Posts: 6
How to store special characters(') into oracle database?
Shailesh Chandra
Ranch Hand

Joined: Aug 13, 2004
Posts: 1081

Use PreparedStatement


Shailesh


Gravitation cannot be held responsible for people falling in love ~ Albert Einstein
Praveena Modugula
Greenhorn

Joined: Apr 21, 2006
Posts: 6
Indetail explanation please...with example
Suppose if I want to insert "Sriman's" aganist name DB field...How is this achieved?
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

By binding the String parameter using a PreparedStatement. Change you code to use a PreparedStatement and you'll see how it works.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
stu derby
Ranch Hand

Joined: Dec 15, 2005
Posts: 333
Originally posted by Praveena Modugula:
Indetail explanation please...with example
Suppose if I want to insert "Sriman's" aganist name DB field...How is this achieved?


http://www.google.com/search?q=preparedstatement+tutorial

Any of the first few results will tell you want you need to know.
Anand Nautiyal
Greenhorn

Joined: May 16, 2006
Posts: 1
try it by first replacing (') by \\' in the string
Eleanor Leong
Greenhorn

Joined: Mar 24, 2006
Posts: 21
You can also add a "'" to your sql statment.
For e.g
insert into Restaurant (name) ('Nick''s Place');
will insert a restraurant name Nick's Place.


Eleanor Leong
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Storing special characters(') into oracle