pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Mark Lewis <mark.lewis@mir3.com>
To: Paul Tomblin <ptomblin@xcski.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: What changed?
Date: Fri, 13 Apr 2007 12:16:14 -0700
Message-ID: <1176491774.8630.101.camel@archimedes> (raw)
In-Reply-To: <20070413184748.GA6562@allhats.xcski.com>
References: <20070413184748.GA6562@allhats.xcski.com>

This is addressed in the FAQ, look at the section titled, "I upgraded
from 7.x to 8.x. Why did my application break?"

http://jdbc.postgresql.org/documentation/faq.html#upgradeTo80

There's also plenty of discussion in the archives that you'll find.

-- Mark Lewis

On Fri, 2007-04-13 at 14:47 -0400, Paul Tomblin wrote:
> This code worked in various versions of Postgres up to and including 7.4
> (as bundled with CentOS 4.3), but fails on 8.1 (as bundled with CentOS
> 5.0) with an exception about being unable to determine the type of
> parameter $2:
> 
>     java.sql.Timestamp startDBDate = null;
>     if (startDate != null)
>     {
>       startDBDate = new java.sql.Timestamp(startDate.getTime());
>     }
> 
>     try
>     {
>       PreparedStatement stmt = con.prepareStatement(
>                 "SELECT    " +  SHOWLIST_COLUMNS +
>                 "FROM           showlists s, showlistsplaylists sc " +
>                 "WHERE          s.id = sc.showlistid AND " +
>                 "               sc.playlistid = ? AND " + 
>                 "               (? IS NULL OR s.showtime >= ?) " +
>                 "ORDER BY       screen, showtime");
>       int               p = 1;
>       stmt.setLong(p, playlistID);
>       p++;
>       if (startDate == null)
>       {
>         stmt.setNull(p, java.sql.Types.TIMESTAMP);
>         p++;
>         stmt.setNull(p, java.sql.Types.TIMESTAMP);
>         p++;
>       }
>       else
>       {
>         stmt.setTimestamp(p, startDBDate);
>         p++;
>         stmt.setTimestamp(p, startDBDate);
>         p++;
>       }
> 
>       ResultSet rs      = stmt.executeQuery();
>       SortedSet retList = parseShowListResultSet(con, rs, venueInfoList);
> 
>       stmt.close();
> 
> Based on something I saw in the list archives, I got it to work by casting
> the timestamp parameters using "?::timestamptz".  But I'm wondering why
> that changed, and are there any other gotchas lurking?  Should I cast any
> timestamp parameter to either ::timestamp or ::timestamptz depending on
> what it is in the db?
> 



view thread (6+ messages)  latest in thread

Message-ID: <1176491774.8630.101.camel@archimedes>
Permalink:  ../1176491774.8630.101.camel@archimedes/
Also on:    postgresql.org/message-id/1176491774.8630.101.camel@archimedes

 · 

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: mark.lewis@mir3.com, ptomblin@xcski.com
  Subject: Re: What changed?
  In-Reply-To: <1176491774.8630.101.camel@archimedes>
  References: <20070413184748.GA6562@allhats.xcski.com> <1176491774.8630.101.camel@archimedes>

* 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