Received: from localhost (maia-3.hub.org [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id E34A99FA162 for ; Wed, 13 Dec 2006 13:09:45 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-new, port 10024) with ESMTP id 23486-06 for ; Wed, 13 Dec 2006 13:09:41 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.4 Received: from smtpout.mac.com (smtpout.mac.com [17.250.248.186]) by postgresql.org (Postfix) with ESMTP id 773729F9B05 for ; Wed, 13 Dec 2006 13:09:41 -0400 (AST) Received: from mac.com (smtpin04-en2 [10.13.10.149]) by smtpout.mac.com (Xserve/8.12.11/smtpout16/MantshX 4.0) with ESMTP id kBDH9em6000663 for ; Wed, 13 Dec 2006 09:09:40 -0800 (PST) Received: from [192.168.100.11] (dnedrow.mcilink.com [209.154.229.107]) (authenticated bits=0) by mac.com (Xserve/smtpin04/MantshX 4.0) with ESMTP id kBDH9bCY016336 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO) for ; Wed, 13 Dec 2006 09:09:39 -0800 (PST) Mime-Version: 1.0 (Apple Message framework v752.2) X-Gpgmail-State: !signed Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <50899926-5B68-42EC-B126-75EBC7E38BF4@mac.com> Content-Transfer-Encoding: 7bit From: David Nedrow Subject: String escaping? Date: Wed, 13 Dec 2006 12:09:33 -0500 To: pgsql-jdbc@postgresql.org X-Mailer: Apple Mail (2.752.2) X-Brightmail-Tracker: AAAAAA== X-Brightmail-scanned: yes X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200612/65 X-Sequence-Number: 16297 Are there any build-in JDK or JDBC (Sun or Postgresql driver) functions for escaping strings before inserting/updating in the DB? Eg., I'm using the following PreparedStatement... addNickname = con.prepareStatement("insert into infobot.nicknames (nickname, firstseen) values (?, to_timestamp(?))"); When providing the value via addNickname.setString(1, this.getString ()), is there some way for me to be sure that the contents of the string I'm feeding to setString() are properly formed/escaped. I'm basically looking for the Java equivalent of PHP's pg_escape_string() function... http://www.php.net/manual/en/function.pg-escape-string.php I was hoping to avoid writing my own escape method, but may have to as I have yet to find anything "off the shelf". Any suggestions would be appreciated, -David