Skip site navigation (1) Skip section navigation (2)

JDBC exception, incompatible types in simple stored procedure.

From: uprooter <uprooter(at)gmail(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: JDBC exception, incompatible types in simple stored procedure.
Date: 2009-01-16 08:42:44
Message-ID: 21494730.post@talk.nabble.com (view raw or flat)
Thread:
Lists: pgsql-jdbc
Hello.
I'm using this code to access a very simple stored procedure  that has 1 in
parameter and 1 out parameter:
        String url = "jdbc:postgresql://localhost/DB2";
        Properties props = new Properties();
        props.setProperty("user", "user");
        props.setProperty("password", "blah");
        Connection conn = DriverManager.getConnection(url, props);
        CallableStatement upperProc = conn.prepareCall("{ ? = call stub( ? )
}");
        upperProc.registerOutParameter(1, Types.OTHER);
        upperProc.setInt(2, 2);
        upperProc.execute();        
        Object upperCased = upperProc.getObject(1);        
        System.out.println("uppercased:" + upperCased.toString());
        upperProc.close();

I'm getting the following exception:
Exception in thread "main" org.postgresql.util.PSQLException: A
CallableStatement function was executed and the out parameter 1 was of type
java.sql.Types=-5 however type java.sql.Types=1111 was registered.

I know I can register to another type but due to other restrictions I can't
change the registration type.
Any idea ?
Thanks.

-- 
View this message in context: http://www.nabble.com/JDBC-exception%2C-incompatible-types-in-simple-stored-procedure.-tp21494730p21494730.html
Sent from the PostgreSQL - jdbc mailing list archive at Nabble.com.


Responses

pgsql-jdbc by date

Next:From: Heikki LinnakangasDate: 2009-01-16 12:10:33
Subject: Re: Problem with committing in XA mode
Previous:From: Vlastimil HavranekDate: 2009-01-16 08:23:46
Subject: Re: Problem with committing in XA mode

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group