Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Pgsql Interfaces Jdbc > Problem calling...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 6 Topic 1871 of 1994
Post > Topic >>

Problem calling stored function

by francesco.storti@[EMAIL PROTECTED] ("Francesco Storti") Jan 17, 2008 at 07:20 PM

------=_Part_1440_23438767.1200594008436
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

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...

------=_Part_1440_23438767.1200594008436
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

<div>Hi to everyone,</div>
<div>I&#39;m having this problem:</div>
<div>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.</div>
<div>I call from my java code the pgsql function in this way:</div>
<div>&nbsp;</div>
<div><font color="#3f7f5f" size="2"><font color="#3f7f5f" size="2">
<p>CallableStatement </p></font>cs = con.prepareCall(&quot;{? = call
comp(?)}&quot;);</font><font size="2">
<p align="left"></p></font><font color="#3f7f5f"
size="2">cs.registerOutParameter(1, Types.INTEGER);</font><font size="2">
<p align="left"></p></font><font color="#3f7f5f" size="2">cs.setInt(2,
min);</font><font size="2">
<p></p></font><font color="#3f7f5f" size="2">cs.execute();</font></div>
<div>Where comp is the name of the function and min is the argument
passed.</div>
<div>When i run my java code, I obtain 1 as result, but the inserts and
update are not performed.</div>
<div>From command line the stored function works, so it&#39;s not a
problem of the stored function.</div>
<div>Is there a problem in performing insert and update in a stored
function called by java code?</div>
<div>I use jdk 1.5, postgres 8.2 and JDBC4 postgresql driver 8.2-506</div>
<div>&nbsp;</div>
<div>The connection with jdbc works, because I execute other insert not in
this stored function within java code.</div>
<div>Thanks for your help and excuse me and my newbye...</div>

------=_Part_1440_23438767.1200594008436--
 




 6 Posts in Topic:
Problem calling stored function
francesco.storti@[EMAIL P  2008-01-17 19:20:08 
Re: Problem calling stored function
tgl@[EMAIL PROTECTED] (T  2008-01-17 15:49:26 
Re: Problem calling stored function
francesco.storti@[EMAIL P  2008-01-18 12:35:12 
Re: Problem calling stored function
tivvpgsqljdbc@[EMAIL PROT  2008-01-18 13:40:57 
Re: Problem calling stored function
oliver@[EMAIL PROTECTED]   2008-01-19 00:56:00 
Re: Problem calling stored function
francesco.storti@[EMAIL P  2008-01-18 13:04:10 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan13V112 Sun Jul 20 4:43:00 CDT 2008.