X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id B6EE09DCAA6 for ; Mon, 23 Jan 2006 16:19:30 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 30489-10-2 for ; Mon, 23 Jan 2006 16:19:30 -0400 (AST) X-Greylist: whitelisted by SQLgrey- Received: from ms-smtp-03.nyroc.rr.com (ms-smtp-03.nyroc.rr.com [24.24.2.57]) by postgresql.org (Postfix) with ESMTP id 56DB39DCA64 for ; Mon, 23 Jan 2006 16:19:27 -0400 (AST) Received: from [192.168.1.100] (cpe-72-224-98-82.nycap.res.rr.com [72.224.98.82]) by ms-smtp-03.nyroc.rr.com (8.13.4/8.13.4) with ESMTP id k0NKJMGf015201; Mon, 23 Jan 2006 15:19:23 -0500 (EST) Message-ID: <43D53A4C.6090906@vilaj.com> Date: Mon, 23 Jan 2006 15:19:24 -0500 From: Will Szopko Reply-To: dba@vilaj.com Organization: vilaj.com, LLC User-Agent: Thunderbird 1.5 (Macintosh/20051201) MIME-Version: 1.0 To: Oliver Jowett , pgsql-jdbc@postgresql.org Subject: Re: Inserting an Interval Using JDBC References: <43D50C19.9040408@vilaj.com> <43D53825.10107@opencloud.com> In-Reply-To: <43D53825.10107@opencloud.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Symantec AntiVirus Scan Engine X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.12 required=5 tests=[AWL=0.120] X-Spam-Score: 0.12 X-Spam-Level: X-Archive-Number: 200601/105 X-Sequence-Number: 14556 Oliver - Thanks, much! I figured the latter out subsequent to my initial post, but had not thought of the former, which ended up being more elegant for my application. Again, thanks. - Will Oliver Jowett wrote: > Will Szopko wrote: > >> I have just upgraded to the 8.1-404 version of the JDBC driver from a >> much older version. In the past I had been able load an interval into >> my database by sending it as a string, as such: >> >> String myInterval = "08:00"; // 8 hour interval >> ... >> stmt.setString(1, myInterval); >> >> Using the new driver I am no longer able to do this and get the >> following error: >> >> column "num_hours" is of type interval but expression is of type text > > Use "CAST (? AS INTERVAL)" in your query, or use the custom > org.postgresql.util.PGInterval type and pass an instance to setObject(). > > -O > > ---------------------------(end of broadcast)--------------------------- > TIP 5: don't forget to increase your free space map settings >