Received: from localhost (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id D6F98633BC3 for ; Tue, 3 Mar 2009 18:01:29 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 28458-06 for ; Tue, 3 Mar 2009 18:01:25 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from ciao.gmane.org (main.gmane.org [80.91.229.2]) by mail.postgresql.org (Postfix) with ESMTP id 80AF7633BA9 for ; Tue, 3 Mar 2009 18:01:25 -0400 (AST) Received: from list by ciao.gmane.org with local (Exim 4.43) id 1Lecfw-0007TR-Gv for pgsql-jdbc@postgresql.org; Tue, 03 Mar 2009 22:01:20 +0000 Received: from ppp-93-104-79-251.dynamic.mnet-online.de ([93.104.79.251]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 03 Mar 2009 22:01:20 +0000 Received: from spam_eater by ppp-93-104-79-251.dynamic.mnet-online.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 03 Mar 2009 22:01:20 +0000 X-Injected-Via-Gmane: http://gmane.org/ To: pgsql-jdbc@postgresql.org From: Thomas Kellerer Subject: Re: Inserting into a uuid column Date: Tue, 03 Mar 2009 23:01:16 +0100 Lines: 34 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: ppp-93-104-79-251.dynamic.mnet-online.de User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.8.1.12) Gecko/20080213 Thunderbird/2.0.0.12 Mnenhy/0.7.5.666 In-Reply-To: X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200903/11 X-Sequence-Number: 19341 Kris Jurka wrote on 03.03.2009 22:13: > You should use setObject(, , Types.OTHER) to > indicate that while you are passing a String, you aren't expecting the > server type to be a string datatype. The problem is that this is a generic import tool, but I'll see what I can do. >> INSERT INTO my_table (guid_column, ...) >> VALUES >> ('a0eebc999c0b4ef8bb6d6bb9bd380a11', ...) > > Here you aren't providing any specific type information, just a literal. > By saying setString or setObject with a String parameter you are saying > that it really is a String. No I'm not using setString() in that example. The Java code would be: Statement stmt = connection.createStatement(); stmt.executeUpdate("INSERT INTO my_table (guid_column) " + " VALUES ('a0eebc999c0b4ef8bb6d6bb9bd380a11')"); So it's passing a literal and is not using a PreparedStatement The Javadocs of setObject(int, Object) say: "The given argument will be converted to the corresponding SQL type before being sent to the database" So I was expecting that the driver will be able to do the same conversion with the PreparedStatement as it is obviously happening when using a literal (though that conversion probably takes place on the server not in the driver). Regards Thomas