Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Oracle Insert query in Java

 
Vijay jai Singh
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


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
Pie
Posts: 20532
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Vijay jai Singh wrote:i cant use stored procedure or Prepared Statement in my project.

Why not?
 
Himanshu Kansal
Ranch Hand
Posts: 257
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you decided what you want to do with these special characters? change them or let them go to the DB as they are?
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34422
347
Eclipse IDE Java VI Editor
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34422
347
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic