Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gEcfq-00077q-2W for pgsql-jdbc@arkaria.postgresql.org; Mon, 22 Oct 2018 16:03:22 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gEcfo-0000NW-7i for pgsql-jdbc@arkaria.postgresql.org; Mon, 22 Oct 2018 16:03:20 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gEXKP-0002LW-Og for pgsql-jdbc@lists.postgresql.org; Mon, 22 Oct 2018 10:20:53 +0000 Received: from prv1-mh.provo.novell.com ([137.65.248.33]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gEXKM-0006IB-TG for pgsql-jdbc@postgresql.org; Mon, 22 Oct 2018 10:20:53 +0000 Received: from INET-PRV1-MTA by prv1-mh.provo.novell.com with Novell_GroupWise; Mon, 22 Oct 2018 04:20:46 -0600 Message-Id: <5BCDA47902000044000098AC@prv1-mh.provo.novell.com> X-Mailer: Novell GroupWise Internet Agent 18.0.2 Date: Mon, 22 Oct 2018 04:20:41 -0600 From: "Kalyan Koka" To: Subject: Stored Procedure call using JDBC is failing Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__Part3309A869.0__=" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --=__Part3309A869.0__= Content-Type: multipart/alternative; boundary="=__Part3309A869.1__=" --=__Part3309A869.1__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Hi, Stored procedure execution using JDBC is failing. JDBC driver build number: 42.2.5 Server version: PostgreSQL 11 Exact error message and stacktrace: org.postgresql.util.PSQLException: ERROR: testproc(integer, integer, = character varying) is a procedure Hint: To call a procedure, use CALL. Position: 15 at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExec= utorImpl.java:2440) at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorIm= pl.java:2183) at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java= :308) at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:441) at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:365) at org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStat= ement.java:143) at org.postgresql.jdbc.PgCallableStatement.executeWithFlags(PgCallableStat= ement.java:77) at org.postgresql.jdbc.PgPreparedStatement.execute(PgPreparedStatement.jav= a:132) at StoredProcedureTest.properCase(StoredProcedureTest.java:42) at StoredProcedureTest.main(StoredProcedureTest.java:65) =20 =20 What you were doing, ideally in code form:=20 CREATE OR REPLACE PROCEDURE public.testproc( batchcount bigint DEFAULT 100000, INOUT outcount bigint DEFAULT 0, INOUT errormsg character varying DEFAULT ' ') =20 .............................. Java code: String commandText =3D "{ call testproc(?,?,?) }"; CallableStatement stmt =3D conn.prepareCall(commandText); stmt.setInt(1, new Integer("10000")); stmt.setInt(2, new Integer("0")); stmt.setString(3, new String("Start")); stmt.registerOutParameter(2, Types.INTEGER); stmt.registerOutParameter(3, Types.VARCHAR); =20 stmt.execute(); Regards, Kalyan Koka --=__Part3309A869.1__= Content-Type: text/html; charset=US-ASCII Content-Transfer-Encoding: quoted-printable =0A=0A=0A=0A
Hi,
<= br>
Stored procedure execution using JDBC is failing.
<= div>
JDBC driver build number: 42.2.5
Server = version: PostgreSQL 11


Exact error message = and stacktrace:
org.postgresql.util.PSQLException: ERROR: testproc(integ= er, integer, character varying) is a procedure
  Hint: To call a = procedure, use CALL.
  Position: 15
 at org.postgresql.core= .v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2440)
=  at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecu= torImpl.java:2183)
 at org.postgresql.core.v3.QueryExecutorImpl.exe= cute(QueryExecutorImpl.java:308)
 at org.postgresql.jdbc.PgStatemen= t.executeInternal(PgStatement.java:441)
 at org.postgresql.jdbc.PgS= tatement.execute(PgStatement.java:365)
 at org.postgresql.jdbc.PgPr= eparedStatement.executeWithFlags(PgPreparedStatement.java:143)
 at = org.postgresql.jdbc.PgCallableStatement.executeWithFlags(PgCallableStatemen= t.java:77)
 at org.postgresql.jdbc.PgPreparedStatement.execute(PgPr= eparedStatement.java:132)
 at StoredProcedureTest.properCase(Stored= ProcedureTest.java:42)
 at StoredProcedureTest.main(StoredProcedure= Test.java:65)

 
 
What you were = doing, ideally in code form:


CREAT= E OR REPLACE PROCEDURE public.testproc(
 batchcount bigint DEFAULT = 100000,
 INOUT outcount bigint DEFAULT 0,
 INOUT errormsg = character varying  DEFAULT ' ')   
................= ..............

Java code:

String commandTex= t =3D "{ call testproc(?,?,?) }";
CallableStatement stmt =3D conn.prepar= eCall(commandText);

stmt.setInt(1, new Integer("10= 000"));
stmt.setInt(2, new Integer("0"));
stmt.setString(3, new = String("Start"));
stmt.registerOutParameter(2, Types.INTEGER);
stmt.r= egisterOutParameter(3, Types.VARCHAR);

  = ;         
stmt.execute();=




Regards,
Kalyan Koka

--=__Part3309A869.1__=-- --=__Part3309A869.0__=--