Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: JDBC Stored Procedure difficulty

Re: JDBC Stored Procedure difficulty

From: <nealgran_at_my-deja.com>
Date: Thu, 24 Jun 1999 14:01:22 GMT
Message-ID: <7ktdna$6k9$1@nnrp1.deja.com>


Thanks for the responses, after getting these helpful hints, and doing some experimentation I found that various DBMS respond to different syntax, but the generic syntax works for each one. The generic syntax on a Stored Procedure is (minor correction to C's version) :

     statement = c.prepareCall("{call sp_interest[(?,?)]}");

where the parameter part enclosed within the square brackets is omitted if the stored procedure has no params.

In article <3771E0F1.FADDEBD0_at_rationalconcepts.com>,   "C." <c_ferguson_at_rationalconcepts.com> wrote:
> Ok, my "Database Programming with JDBC and Java" (ISBN 1-56592-270-0)
> pg.62 gives the statement as: statement = c.prepareCall("{call
> sp_interest[?,?)]}");
> (Notice all the different kinds of brackets.) sp_interest is the
example
> stored proc looking for two input params. I suggest you add the curly
> brackets to your call.
> Best of luck,
> Cindy Ferguson, Rational Concepts, INC
>
> nealgran_at_my-deja.com wrote:
>
> > I am writing a java application which needs to access either Oracle,
or
> > SQLServer DBMS. I have type 4 drivers for each, and I have
succesfully
> > writen JDBC code to execute general queries using
preparedStatements.
> > However to access a Stored Procedure I believe I need to use a
> > callableStatement.
> >
> > The problem is that I can access the SQLServer Stored procedure
using
> > the syntax:
> >
> > CallableStatement cstmt = con.prepareCall("PutWJ");
> > cstmt .execute();
> > where con is an established database connection, and PutWJ is the
> > (parameterless) stored procedure set up in the SQLServer.
> >
> > The same syntax does not work for an oracle 8 server on which PutWJ
was
> > also established. The error returned was: 'ORA-00900: invalid SQL
> > statement'. I tried various tweeks of the syntax such as :
> > CallableStatement cstmt = con.prepareCall("Call PutWJ");
> > but had no success.
> >
> > If anyone could shed some light on my troubles I would appreciate it
> >
> > Sent via Deja.com http://www.deja.com/
> > Share what you know. Learn what you don't.
>
>

Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't. Received on Thu Jun 24 1999 - 09:01:22 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US