aspose file tools*
The moose likes Web Services and the fly likes SQL Insert Problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "SQL Insert Problem" Watch "SQL Insert Problem" New topic
Forums: Web Services JDBC
Author

SQL Insert Problem

Johny Lee
Greenhorn

Joined: Dec 14, 2012
Posts: 4
I have column in my database which is client Remarks and it's defined as TEXT but I have been having errors whenever a client enters remarks such "I'm not doing this" but if a client enters "I am not doing this". It's fine. Please help. The error occurs whenever a client completes a form online on the website, coding was done with php and MySQL for the website.
Praful Thakare
Ranch Hand

Joined: Feb 10, 2001
Posts: 613
well this is not webservice question, but with 2 posts only you look new to JavaRanch.

replace all your special characters with escape sequence for mysql, i think it is \, so something like.



In future, put your questions to relevant forums


All desirable things in life are either illegal, banned, expensive or married to someone else !!!
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18113
    
    8

Would I be correct in guessing that you are generating your SQL insert command by a Java string concatenation which looks something like this?



If so then you have the "O'Brien" problem. So stop doing that and use a PreparedStatement instead. Here's a link to the tutorial: Using Prepared Statements.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: SQL Insert Problem
 
Similar Threads
How to Change the File Name for Each Uploaded Files to the Socket Server?
giving textfield input in marathi font
jQuery in Action and jQuery API
Getting data for display in a new JFrame
Why do we need a framework other than JDBC to access DB?