pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Will Szopko <dba@vilaj.com>
To: Oliver Jowett <oliver@opencloud.com>
To: pgsql-jdbc@postgresql.org
Subject: Re: Inserting an Interval Using JDBC
Date: Mon, 23 Jan 2006 15:19:24 -0500
Message-ID: <43D53A4C.6090906@vilaj.com> (raw)
In-Reply-To: <43D53825.10107@opencloud.com>
References: <43D50C19.9040408@vilaj.com>
	<43D53825.10107@opencloud.com>

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
> 




view thread (3+ messages)

Message-ID: <43D53A4C.6090906@vilaj.com>
Permalink:  ../43D53A4C.6090906@vilaj.com/
Also on:    postgresql.org/message-id/43D53A4C.6090906@vilaj.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: dba@vilaj.com, oliver@opencloud.com
  Subject: Re: Inserting an Interval Using JDBC
  In-Reply-To: <43D53A4C.6090906@vilaj.com>
  References: <43D50C19.9040408@vilaj.com> <43D53825.10107@opencloud.com> <43D53A4C.6090906@vilaj.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox