This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Originally posted by Mike Yu: Hi, How can I insert a string with ' into a table in DB2?
Use a PreparedStatement ( setString() method ) and it will take care of it for you. If you need to use a statement you have to create a routine that escapes it with the DB2 escape character. Assuming it is 2 single quotes, this routine would work for you: