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
Register / Login


JavaRanch » Java Forums » Databases » JDBC
Reply 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: 1076

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://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Storing special characters(') into oracle
 
Similar Threads
Reg. identifier
Java Cryptography Extension
Hey to all - a regex Q
HQL + LIKE + _
filter the spacial characters from a String taken from hidden field ?