| Author |
how to deal with the special character in java and oracle!!!
|
Geoffrey Ren
Greenhorn
Joined: Nov 25, 2002
Posts: 18
|
|
when I got the user inputting. For example, user input the value "test's"/"test&s"/"test\s". How to insert the value into oracle DB by jdbc. Thanks for you reply!
|
 |
Jamie Robertson
Ranch Hand
Joined: Jul 09, 2001
Posts: 1879
|
|
PreparedStatement will do the escaping for you: either that or do a loop and escape every "bad" character in the string. The choice is usually PreparedStatement. Jamie
|
 |
Peter den Haan
author
Ranch Hand
Joined: Apr 20, 2000
Posts: 3252
|
|
Anything other than a PreparedStatement is madness. This becomes even clearer when you start to consider things like date formats. Ok, so you could use ANSI SQL escape syntax -- hands up everyone who can write down a date literal using escape syntax without consulting some kind of reference! And now hands up those who'd never heard of this syntax before... Thought so. - Peter
|
 |
Surendran Velath
Greenhorn
Joined: Apr 23, 2003
Posts: 19
|
|
You can use a Statement also stmt.executeUpdate("test''s"/"test&s"/"test\s"); only remember that a single quote needs an additional single quote test''s all other characters are accepted directly
|
 |
 |
|
|
subject: how to deal with the special character in java and oracle!!!
|
|
|