Executing stored procedures from java code:NEWBIE

Executing stored procedures from java code:NEWBIE

Post by Tom » Thu, 13 Dec 2001 06:01:45



I am attempting to execute a stored procedure from within some java code
i have enclosed the relevany snippet:

                // Create a Statement

                stmnt = oraConn.createStatement();
                s = "BEGIN  RecoverActivity; END;" ;
                rs = stmnt.executeQuery (s);
                rs.next();
                oraRows = rs.getInt("num");
                rs.close();

The stored procedure can be xecuted in pl/SQL without a problem biut I
keep getting a problem in Java, any help about the syntax would be
greatly appreciated

 
 
 

Executing stored procedures from java code:NEWBIE

Post by C. Ferguso » Thu, 13 Dec 2001 07:00:01


Hi,
   It should be a CallableStatement rather than the Statement.
   I'll leave it to you to look up the api for CallableStatement.

regards,
cindy


> I am attempting to execute a stored procedure from within some java code
> i have enclosed the relevany snippet:

>                 // Create a Statement

>                 stmnt = oraConn.createStatement();
>                 s = "BEGIN  RecoverActivity; END;" ;
>                 rs = stmnt.executeQuery (s);
>                 rs.next();
>                 oraRows = rs.getInt("num");
>                 rs.close();

> The stored procedure can be xecuted in pl/SQL without a problem biut I
> keep getting a problem in Java, any help about the syntax would be
> greatly appreciated


 
 
 

1. Calling a Java Stored Procedure from another Java Stored Stored Procedure

Hi,
I'm using the stored procedure builder of DB2 UDB v6.1 on NT to create a
Java Stored Procedure to call another Java Stored Procedure. Both of
them belong to the same project in stored procedure builder.
The sp that calls another sp has the code as follows:
// Calling another java sp -- ErrorHandler
ErrorHandler err = new ErrorHandler();
err.execute("Test #1", 100, "Testing #1");
When I want to build the sp which calls another sp from within, it gave
me an error as follows:
C:\IBMVJava\ide\tools\com-ibm-db2-tools-dev-spb-ivj\spb\bld953747549650\
com\intertrac\datamart\sp\SelectBillShipAddr.java:18: Class
com.intertrac.datamart.sp.ErrorHandler not found in type declaration.
ErrorHandler err = new ErrorHandler();
Does anyone have any clue of how this can be properly done ? Please let
me know.
Thanks,
ra

Sent via Deja.com http://www.deja.com/
Before you buy.

2. Strange behaviour when Value List has Word "ALL"

3. Calling Java code on disc from a Java Stored Procedure

4. Excel object & charts

5. Gettting SQL0751N trying to call java stored procedure from a java stored procedure

6. Color of a column in a DBGrid

7. Newbie: Cannot execute stored procedure.

8. Out of LOCKS - SQLS won't start - HELP!

9. How to call/execute a stored procedure with parameters from code

10. Newbie Q - Executing stored procedure from select list?

11. Dynamically executing a stored procedure with a return code

12. Execute some codes more than once in Stored Procedure

13. Newbie...Can a Stored Procedure Execute DTS package?