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 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 EJB 3 in Action this week in the EJB and other Java EE Technologies 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: 19543
    
  16

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: 29240
    
139

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: 29240
    
139

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Oracle Insert query in Java
 
Similar Threads
Special Characters in JSP Page
Using Oracle package variables in JDBC.
Techniques for getting auto generated key for ms access?
difficulty in inserting value into oracle "long" datatype column
Special Characters