pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Oliver Jowett <oliver@opencloud.com>
To: Donny Tjandra <dtjandra@pcthome.com>
Cc: 'pgsql-jdbc@postgresql.org' <pgsql-jdbc@postgresql.org>
Subject: Re: Function not found with JDBC 8.0 driver and later
Date: Thu, 16 Jun 2005 10:50:34 +1200
Message-ID: <42B0B0BA.9090504@opencloud.com> (raw)
In-Reply-To: <E4987A7A1042D511848F0008C71BB06B04D8EC02@PCT_EXCH>
References: <E4987A7A1042D511848F0008C71BB06B04D8EC02@PCT_EXCH>

Donny Tjandra wrote:
> I'm running PostgreSQL 8.0.3 for Windows. In the database I have a
> function defined like this:
> 
> CREATE OR REPLACE FUNCTION get_property_list2(text, date, int4, int4)
> ...
>  
> The parameters are passed from JDBC like this:
> 
> PreparedStatement ps
> ps.setInt(3, ((Integer)queryParameters[2]).intValue());
> ps.setLong(4, ((Long)queryParameters[3]).longValue());
> 
> With pg73jdbc3.jar the function call works fine. With
> pg80b1.308.jdbc3.jar or postgresql-8.0-311.jdbc3.jar, the driver can't
> seem to recognize the database function. I get stack trace as shown
> below. Seems like there's a mismatch with long integer type mapping
> between 8.0+ JDBC drivers and PostgreSQL? Can this be looked at for
> future release of the driver? Thanks.

This is an application bug -- either explicitly cast the parameter to
the right type in the query itself, or use an appropriate parameter
setting method (setInt or setObject(..., Types.INTEGER) in your case).

The change was that the 8.0 driver now uses server-side preparation of
queries which means that parameters are more strongly typed -- you don't
get the previous implicit conversion from a textual representation of
the parameter to whatever type seems correct.

-O



view thread (3+ messages)

Message-ID: <42B0B0BA.9090504@opencloud.com>
Permalink:  ../42B0B0BA.9090504@opencloud.com/
Also on:    postgresql.org/message-id/42B0B0BA.9090504@opencloud.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: oliver@opencloud.com, dtjandra@pcthome.com
  Subject: Re: Function not found with JDBC 8.0 driver and later
  In-Reply-To: <42B0B0BA.9090504@opencloud.com>
  References: <E4987A7A1042D511848F0008C71BB06B04D8EC02@PCT_EXCH> <42B0B0BA.9090504@opencloud.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