Win a copy of Machine Learning Systems: Designs that scale this week in the Scala forum
or Xamarin in Action: Creating native cross-platform mobile apps in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Oracle Insert query in Java  RSS feed

 
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.
 
Sheriff
Posts: 21328
87
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?
 
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?
 
author & internet detective
Marshal
Posts: 38249
623
Eclipse IDE Java VI Editor
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 38249
623
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.
 
Why does your bag say "bombs"? The reason I ask is that my bag says "tiny ads" and it has stuff like this:
Rocket Oven Kickstarter - from the trailboss
https://coderanch.com/t/695773/Rocket-Oven-Kickstarter-trailboss
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!