Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

java/oracle and insert statement with special characters

807598Sep 19 2006 — edited Sep 21 2006
I have created a java program that take a text format and insert into Oracle database.

create table a (testfield varchar (50));

The html allow the user to enter free form text and the java program insert into the database without any more.

Now the problem, if the user enter single quote, ie: I'll testing., The program failed because it is actually doing

insert into a values ('I'm testing.'); since oracle cannot recognize the extra single quote. I need to somehow change the value to 'I''m testing.

What is the easiest format to do this? What happen if the user enter the value ('A & B company') All these special character cause my program to bomb.

I need help as how to handle special characters.

Thanks,
Maria
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 19 2006
Added on Sep 19 2006
8 comments
3,307 views