By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,649 Members | 1,490 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,649 IT Pros & Developers. It's quick & easy.

Apostrophe problem

P: 3
Hi, I'm developing a program which open text files from the system's hard drive using java language. The problem I'm encountering is when I save the content- whether it be in JPanel or JTextArea- which has some apostrophes to mysql database . I'll appreciate if I'm directed to articles which will enlighten me.
Jan 29 '13 #1

✓ answered by Rabbit

I didn't mean do it manually. Use a replace function to escape the quotes before running the query.

Share this Question
Share on Google+
3 Replies


Rabbit
Expert Mod 10K+
P: 12,421
You need to escape the apostrophes in the value using a backslash before running the query.
Jan 29 '13 #2

P: 3
@Rabbit, I appreciate and value ur response. In my case though the scenario is a bit tricky. I open a ten pages file full of these apostrophes and I was wondering is there could b any way out by which I can be able to simply store the value in that jtextarea to mysql with its apostrophes without reporting this exceptions?
Jan 30 '13 #3

Rabbit
Expert Mod 10K+
P: 12,421
I didn't mean do it manually. Use a replace function to escape the quotes before running the query.
Jan 30 '13 #4

Post your reply

Sign in to post your reply or Sign up for a free account.