single quotation confusion

From: R10 <ymyib13(at)hotmail(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: single quotation confusion
Date: 2013-04-06 15:18:12
Message-ID: 1365261492317-5751065.post@n5.nabble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

i am connecting a postgresql database to a netbeans form , and when i try to
execute a query which includes a string entered through a Jtextfield that
contain the special charachter " ' " it reads it as a single quotation
for example if a String txt = "it's cold" and to be inserted into a sql
query "insert into test values ('"+txt+"')";
it gives me
syntax error at or near "s"

any ideas how to solve that problem ??

--
View this message in context: http://postgresql.1045698.n5.nabble.com/single-quotation-confusion-tp5751065.html
Sent from the PostgreSQL - jdbc mailing list archive at Nabble.com.

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message David Johnston 2013-04-07 01:10:44 Re: single quotation confusion
Previous Message Dave Cramer 2013-04-05 19:03:20 Re: Publish artifacts to Maven central