File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to get RSSItem/any String with a " or ' charchter into DB?

 
Itay Cohen
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear All,
I am trying to write an application that will write RSS Items into a (Postgre SQL) DB.
However, while I succeeded in getting a list of sources from one table, and reading all their Items - (displaying them on screen)
I failed to write them into a table. I am trying now to enter just 2 rows. Yet I get this message

org.postgresql.util.PSQLException: ERROR: unterminated quoted string at or near "')"
Position: 87

I tried to deal with the ` char. At one point I have succeeded, yet I had problem with any " char at my Item strings (at title, exc.)

So I also have no idea how to change the " char. While changing the ' char is by using " ' " I cannot write 3*", can I??

(I CANNOT WRITE ri.getRss_title().replaceAll("'",""" ===that is 3*").



***********************************************************************************
P.s My method for writing the Item to a List is this:




Thank you very very much!
 
Martin Vajsar
Sheriff
Pie
Posts: 3747
62
Chrome Netbeans IDE Oracle
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch!

You need to use a PreparedStatement. This way you don't have to escape the string being processed in any way. We have a page on it here, and you might want to read the relevant parts of JDBC Tutorial too (or even better, the whole tutorial).

Also, next time please use the code tags when posting a code, it will make it much more readable. I've added them to your post myself this time.
 
Itay Cohen
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you SO much! You're wonderful.
Also - sorry I did not use the right tools (code tags). I'm new here..
Hope to contribute to this community.

 
Martin Vajsar
Sheriff
Pie
Posts: 3747
62
Chrome Netbeans IDE Oracle
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're welcome
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic