pg.ddx.io pgsql-jdbc@postgresql.org mailing list archive
help / color / mirror / Atom feedFunction not found with JDBC 8.0 driver and later
3+ messages / 3 participants
[nested] [flat]
* Function not found with JDBC 8.0 driver and later
@ 2005-06-15 19:13 Donny Tjandra <dtjandra@pcthome.com>
2005-06-15 20:03 ` Re: Function not found with JDBC 8.0 driver and later Dave Cramer <pg@fastcrypt.com>
2005-06-15 22:50 ` Re: Function not found with JDBC 8.0 driver and later Oliver Jowett <oliver@opencloud.com>
0 siblings, 2 replies; 3+ messages in thread
From: Donny Tjandra @ 2005-06-15 19:13 UTC (permalink / raw)
To: pgsql-jdbc
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.
java.sql.SQLException: ERROR: function get_property_list2(character varying,
date, integer, bigint) does not exist
at
org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorI
mpl.java:1471)
at
org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.ja
va:1256)
at
org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:175)
at
org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.j
ava:389)
at
org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2St
atement.java:330)
at
org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statem
ent.java:240)
at
org.apache.tomcat.dbcp.dbcp.DelegatingPreparedStatement.executeQuery(Delegat
ingPreparedStatement.java:92)
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Function not found with JDBC 8.0 driver and later
2005-06-15 19:13 Function not found with JDBC 8.0 driver and later Donny Tjandra <dtjandra@pcthome.com>
@ 2005-06-15 20:03 ` Dave Cramer <pg@fastcrypt.com>
1 sibling, 0 replies; 3+ messages in thread
From: Dave Cramer @ 2005-06-15 20:03 UTC (permalink / raw)
To: Donny Tjandra <dtjandra@pcthome.com>; +Cc: pgsql-jdbc
This is because the 8.0 drivers expect you to pass an int when the
function signature is int. Parameter 4 is an int, and you are passing
a long.
Dave
On 15-Jun-05, at 3:13 PM, 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.
>
> java.sql.SQLException: ERROR: function get_property_list2(character
> varying, date, integer, bigint) does not exist
> at
> org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse
> (QueryExecutorImpl.java:1471)
> at org.postgresql.core.v3.QueryExecutorImpl.processResults
> (QueryExecutorImpl.java:1256)
> at org.postgresql.core.v3.QueryExecutorImpl.execute
> (QueryExecutorImpl.java:175)
> at org.postgresql.jdbc2.AbstractJdbc2Statement.execute
> (AbstractJdbc2Statement.java:389)
> at
> org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags
> (AbstractJdbc2Statement.java:330)
> at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery
> (AbstractJdbc2Statement.java:240)
> at
> org.apache.tomcat.dbcp.dbcp.DelegatingPreparedStatement.executeQuery
> (DelegatingPreparedStatement.java:92)
>
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Function not found with JDBC 8.0 driver and later
2005-06-15 19:13 Function not found with JDBC 8.0 driver and later Donny Tjandra <dtjandra@pcthome.com>
@ 2005-06-15 22:50 ` Oliver Jowett <oliver@opencloud.com>
1 sibling, 0 replies; 3+ messages in thread
From: Oliver Jowett @ 2005-06-15 22:50 UTC (permalink / raw)
To: Donny Tjandra <dtjandra@pcthome.com>; +Cc: pgsql-jdbc
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
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2005-06-15 22:50 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-06-15 19:13 Function not found with JDBC 8.0 driver and later Donny Tjandra <dtjandra@pcthome.com>
2005-06-15 20:03 ` Dave Cramer <pg@fastcrypt.com>
2005-06-15 22:50 ` Oliver Jowett <oliver@opencloud.com>
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