This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
Is there an escape sequence that you can use to insert a string that contains a single quote? e.g.; "Carey's data". I tried a backslash but it didn't work, the backslash actually ended up in the database.
The easiest way is to use a PreparedStatement instead of Statement. PreparedStatements automatically escape these troublesome characters. The other method is to escape single quotes with another single quote: "insert into ... values ( "Sam", "O''Reilly" ) this will insert "O'Reilly" into the database. Jamie
I have seen things you people would not believe, attack ships on fire off the shoulder of Orion, c-beams sparkling in the dark near the Tennhauser Gate. All these moments will be lost in time, like tears in the rain.