X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 842AE3A4B03 for ; Sat, 13 Nov 2004 22:49:20 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 95312-06 for ; Sat, 13 Nov 2004 22:49:01 +0000 (GMT) Received: from yass.opencloud.co.nz (yass.opencloud.co.nz [203.79.85.162]) by svr1.postgresql.org (Postfix) with ESMTP id 358593A1EC0 for ; Sat, 13 Nov 2004 22:49:01 +0000 (GMT) Received: from 203-79-104-60.cable.paradise.net.nz ([203.79.104.60] helo=[192.168.0.21]) by yass.opencloud.co.nz with asmtp (Exim 3.35 #1 (Debian)) id 1CT6hL-0007tY-00; Sun, 14 Nov 2004 11:48:47 +1300 Message-ID: <41969009.2040804@opencloud.com> Date: Sat, 13 Nov 2004 22:51:53 +0000 From: Oliver Jowett User-Agent: Mozilla Thunderbird 0.8 (Windows/20040913) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Franco Bruno Borghesi Cc: Kris Jurka , pgsql-jdbc@postgresql.org Subject: Re: Question References: <41963B7A.8080900@akyasociados.com.ar> <41965186.4040300@akyasociados.com.ar> In-Reply-To: <41965186.4040300@akyasociados.com.ar> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200411/111 X-Sequence-Number: 11533 Franco Bruno Borghesi wrote: > As you see, in my current code I have no way to know to which datatype > the field maps to. So, is there any easy/generic way to set NULLs, no > matter what datatype the field is? No. The driver has exactly the same problem as you ran into, namely that there's no way to infer a type given just a bare null. You should provide a SQL Types value via setNull(i,type) or setObject(i,null,type). You may want to change your API to pass down type information when you are dealing with nulls. The backend does have a mechanism to infer the type of a parameter, but it's sufficiently unpredictable for arbitary queries that we decided not to use it in the driver, given that the rest of JDBC is quite strongly typed. -O