Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: JDBC Stored Procedure difficulty
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.
Received on Thu Jun 24 1999 - 02:40:33 CDT