|
-
Dealing with SQL special characters with Java
I am writing a program to convert the information read from a url into an "INSERT" statement so as that I can use this information on my own page. The problem is that I am saving some of the HTML tags i.e. <table>, as Strings. So for example....
String table1 =
"<table width="100%" border="0" cellspacing="0" cellpadding="0" class="table_border">
..
..
..
..etc....
</table>"
I then want to insert this string into a field in a database however, the quotation marks (") prevent the string from being read as a whole string! SQL interprets them as operators and doesnt know what to do. I know that Perl has a function to deal with this - I think its the escape function - but i was wondering is there a way similar to do it in java without having to go through each quotation mark and deal with them seperately as i have a lot of code.
e.g. Srting table1 = "......";
String escaped_table1 = table1.escape();
.... Insert into db values (escaped_table1);
Thanks in advance for your help!!!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks