troubleshooting Question

inserting a string into a table

Avatar of bhu
bhu asked on
Java
18 Comments1 Solution985 ViewsLast Modified:
I have a  form with textboxes. I take the user values with request.getparameter() in a jsp. I want to insert these string values into a table on db2. One of the strings has an apostrophe contained in it.

For example,
"INSERT INTO Store VALUES" +
 "(1, 'Macy's Store', 'Palo Alto', 'CA')";

I get an error with insertion, because 'Macy's Store' contains an apostrophe and the insert expects a comma after 'Macy' and so the error message shows that the number of the values to be inserted is more than the number of columns actually contained.

Can anyone help me how to solve this problem?

bhu
ASKER CERTIFIED SOLUTION
nikhilsp

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 18 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 18 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros