Dear Tomasz,

as your example works fine here, could you please provide
us with a vtrace of your program execution, to check what
is your problem.

(see http://sapdb.2scale.net/moin.cgi/VTrace  how to make 
 one)

Also please check that there is any data in DBA.HELP to be
selected, of course.

Regards

Alexander Schr�der
SAP Labs Berlin

> -----Original Message-----
> From: Karpowicz, Tomasz [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, September 26, 2002 5:03 PM
> To: [EMAIL PROTECTED]
> Subject: ResultSet From Stored Procedure does not work
> 
> 
> I use the newest software (7.3.00.25) - kernel and jdbc driver 
> 
> What is happening:
> Simply after the 
> rs = cstmt.getResultSet();
> There is no rows in rs, so rs.next() gives false.
> 
> 
> 
> Here is my sql code:
> 
> CREATE DBPROC testproc  RETURNS CURSOR AS
>       BEGIN
>       DECLARE :$CURSOR CURSOR FOR SELECT * FROM DBA.HELP;
> END;
> 
> Here is my java test code:
> 
> import java.sql.*;
> public class TestStoredProc {
>       public static void main(String[] args) {
>               Connection connection = null;
>               CallableStatement cstmt = null;
>               ResultSet rs = null;
>               try {
>       
> Class.forName("com.sap.dbtech.jdbc.DriverSapDB");
>                       connection =
>                               DriverManager.getConnection(
>       
> "jdbc:sapdb://127.0.0.1/TST?user=dba&password=dba");
>                       cstmt = connection.prepareCall("call
> dba.testproc");
>                       cstmt.execute();
>                       do {
>                               rs = cstmt.getResultSet();
>                               while (rs.next()) {
>       
> System.out.println(rs.getString(5));
>                               }
>                       }
>                       while (cstmt.getMoreResults());
>               }
>               catch (Exception exc) {
>                       System.out.println(exc);
>               }
>               finally {
>                       try {
>                               rs.close();
>                               connection.close();
>                       }
>                       catch (Exception exc) {}
>               }
>       }
> }
> 
> 
> Tomasz Karpowicz
> HPCI Solution Architect
> HPS Poland
> _______________________________________________
> sapdb.general mailing list
> [EMAIL PROTECTED]
> http://listserv.sap.com/mailman/listinfo/sapdb.general
> 
_______________________________________________
sapdb.general mailing list
[EMAIL PROTECTED]
http://listserv.sap.com/mailman/listinfo/sapdb.general

Reply via email to