How can I deal with an apostrophy

My simple questions is how can I deal with an apostrophy when I trying to save to the table, here is an example in how I am saving.

'Sandr'as Casa' this gives me an error message. I have to do it like this

Strings.replace("Sandr'as Casa"," ' "," ' ' "), a package function

SQLDesFollow = "UPDATE [CRVMReq] " +

"SET [SkillSet]='" + Strings.replace("Sandr'as Casa"," ' "," ' ' ")+ "'" WHERE [ReqId]='" + ReqValuesReqId[4] + "";

dbs.execute(SQLDesFollow);

SQLDesFollow = "UPDATE [CRVMReq] " +

"SET [SkillSet]='Sandr'as Casa' WHERE [ReqId]='" + ReqValuesReqId[4] + "";

dbs.execute(SQLDesFollow);

any help will be appreciated.

[703 byte] By [CDCDevelopera] at [2007-11-27 11:58:26]
# 1

Here is the magic word: PreparedStatement.

Start here: http://java.sun.com/docs/books/tutorial/jdbc/basics/prepared.html

BalusCa at 2007-7-29 19:19:35 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 2

> Here is the magic word: PreparedStatement.

>

> Start here:

> http://java.sun.com/docs/books/tutorial/jdbc/basics/pr

> epared.html

Seconded, thirded and fourthed.

And if later readers of this thread feel that they would like to provide another answer then they should think again because they would be wrong.

There is only one correct answer to this question. PreparedStatement.

cotton.ma at 2007-7-29 19:19:35 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 3

Note as well that there is no guarantee that apostrophe is the only character that must be escaped either.

PreparedStatement (driver) should deal with all of the possibilities.

jschella at 2007-7-29 19:19:35 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...