Hi OliverA.
In the TestHandler class of the original version of JRDC2 I have performed these tests:
[CODE lang="b4x" title="TestHandler B4X"]Dim Jo As JavaObject = Me
Dim RSet As ResultSet = Jo.RunMethod("desdeJava", Array("1"))
Do While RSet.NextRow '<--- OK
Log($"Cursor.GetString(Cursor.GetColumnName(0)): ${RSet.GetString(RSet.GetColumnName(0))}"$)
Log($"Cursor.GetString2(0): ${RSet.GetString2(0)}"$)
Loop[/CODE]
Using java code I can get the data for the ResultSet.
If you activate the While structure then there are no rows for the ResultSet that receives the data.
[CODE lang="java" title="TestHandler Java"]#If JAVA
import java.sql.*;
import oracle.jdbc.*;
public static Object desdeJava(String idx) throws Exception {
try {
DriverManager.registerDriver (new oracle.jdbc.OracleDriver());
Connection conn = DriverManager.getConnection("jdbc

racle:thin

localhost:1521:xe", "user", "pass");
CallableStatement stmt = conn.prepareCall("BEGIN pa_nomusua1(?, ?); END;");
stmt.setString(1, idx); //<--- Id Usuario
stmt.registerOutParameter(2, OracleTypes.CURSOR); //<--- REF CURSOR
stmt.execute();
//*************************************************************
//ResultSet rs = ((OracleCallableStatement)stmt).getCursor(2);
//while (rs.next()) {
// System.out.println(rs.getString("nombre"));
//}
//
//rs.close();
//rs = null;
//stmt.close();
//stmt = null;
//conn.close();
//conn = null;
//*************************************************************
return ((OracleCallableStatement)stmt).getCursor(2);
}
catch (SQLException e) {
System.out.println(e.getLocalizedMessage());
return null;
}}
#End If[/CODE]
This way I can get the column number and its name, but the Cursor.NextRow doesn't find any rows:
[CODE lang="b4x" title="TestHandler B4X"]Dim con As SQL = Main.rdcConnector1.GetConnection
Dim Cursor As ResultSet
'Dim storeprox As JavaObject = con.CreateCallStatement("BEGIN pa_nomusua1(?,?); END;", Null)
Dim storeprox As JavaObject = con.CreateCallStatement("CALL pa_nomusua1(?,?)", Null)
storeprox.RunMethod("setString", Array(1,"1"))
storeprox.RunMethod("registerOutParameter", Array(2,2012)) 'REF_CURSOR 2012
storeprox.RunMethod("execute", Null)
Cursor = storeprox.RunMethod("getObject", Array(2))
If Cursor.IsInitialized Then
Log($"Total de columnas: ${Cursor.ColumnCount}"$)
If Cursor.ColumnCount > 0 Then
Log($"Nombre de columna 0: ${Cursor.GetColumnName(0)}"$)
End If
Do While Cursor.NextRow '<--- !!!!!!
Log($"Cursor.GetString(Cursor.GetColumnName(0)): ${Cursor.GetString(Cursor.GetColumnName(0))}"$)
Log($"Cursor.GetString2(0): ${Cursor.GetString2(0)}"$)
Loop
Cursor.Close
End If
storeprox.RunMethod("close", Null)
con.Close[/CODE]
In this way Cursor.ColumnCount returns -1
java.sql.SQLException: Unable to fetch on a PLSQL statement: next
[CODE lang="b4x" title="TestHandler B4X"]Dim con As SQL = Main.rdcConnector1.GetConnection
Dim Cursor As ResultSet
Dim storeprox As JavaObject = con.CreateCallStatement("BEGIN pa_nomusua1(?,?); END;", Null)
'Dim storeprox As JavaObject = con.CreateCallStatement("CALL pa_nomusua1(?,?)", Null)
storeprox.RunMethod("setString", Array(1,"1"))
storeprox.RunMethod("registerOutParameter", Array(2,2012)) 'REF_CURSOR 2012
Cursor = con.ExecCall(storeprox)
If Cursor.IsInitialized Then
Log($"Total de columnas: ${Cursor.ColumnCount}"$)
If Cursor.ColumnCount > 0 Then
Log($"Nombre de columna 0: ${Cursor.GetColumnName(0)}"$)
End If
Do While Cursor.NextRow '<--- !!!!!!
Log(Cursor.GetString2(0))
Loop
Cursor.Close
End If
'
con.Close[/CODE]
I hope I can give you clues.
Greetings.