*
The moose likes JDBC and the fly likes Oracle Insert query in Java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Oracle Insert query in Java " Watch "Oracle Insert query in Java " New topic
Author

Oracle Insert query in Java

Vijay jai Singh
Greenhorn

Joined: Jan 07, 2009
Posts: 26


Hi

I am trying to insert user's input in oracle using Java JDBC. I have to use Insert query.

Oracle's column type is varchar2.

I am able to insert if user is not entering special character. when user enter special character like # ? / and $ it gives exception

Please help to parse these special character. i need to use insert query i cant use stored procedure or Prepared Statement in my project.

Thank you for your time.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19674
    
  18

Vijay jai Singh wrote:i cant use stored procedure or Prepared Statement in my project.

Why not?


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Himanshu Kansal
Ranch Hand

Joined: Jul 05, 2009
Posts: 257
Have you decided what you want to do with these special characters? change them or let them go to the DB as they are?


Experience and talent are independent of age
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30353
    
150

Moving to the JDBC forum


[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
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30353
    
150

Vijay jai Singh wrote:i cant use stored procedure or Prepared Statement in my project.

PreparedStatement is a best practice. Perhaps the person meant you can't use CallableStatement. I would double check. ANd ask the person why you can't use PreparedStatement.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Oracle Insert query in Java