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

Reply via email to