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

Problem calling stored function

From: "Francesco Storti" <francesco(dot)storti(at)gmail(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Problem calling stored function
Date: 2008-01-17 18:20:08
Message-ID: bf6786b40801171020o2ffbbf28l331e080b63073dd9@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-jdbc
Hi to everyone,
I'm having this problem:
I have implemented a stored function that take as argument an integer, in
its body execute some inserts and deletes depending on the argument, and
returns 1 when ended.
I call from my java code the pgsql function in this way:


CallableStatement cs = con.prepareCall("{? = call comp(?)}");

cs.registerOutParameter(1, Types.INTEGER);

cs.setInt(2, min);

cs.execute();
Where comp is the name of the function and min is the argument passed.
When i run my java code, I obtain 1 as result, but the inserts and update
are not performed.
>From command line the stored function works, so it's not a problem of the
stored function.
Is there a problem in performing insert and update in a stored function
called by java code?
I use jdk 1.5, postgres 8.2 and JDBC4 postgresql driver 8.2-506

The connection with jdbc works, because I execute other insert not in this
stored function within java code.
Thanks for your help and excuse me and my newbye...

Responses

pgsql-jdbc by date

Next:From: Tom LaneDate: 2008-01-17 20:49:26
Subject: Re: Problem calling stored function
Previous:From: Mark LewisDate: 2008-01-17 16:06:24
Subject: Re: trying to connect to pg from within a local network

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