transfer resultset
Brought to you by:
saaaafa
Hi Staff,
I have a question regarding javabridge and i'm hoping this is the correct email. I'm trying to return a resultset created in
java to php for scrolling.
the below returns 0 rows
if($sid != null && $sid != 0)
{
$result = new JavaClass('java.sql.ResultSet');
$result = $studentLogin->returnResultSet((int)$sid);
$rowcount=mysqli_num_rows($result);
printf("Result set has %d rows.\n",$rowcount);
}
however, when I return an arraylist i get a record.
$studentList = new java("java.util.ArrayList");
$studentList = $studentLogin->retrieveStudent((int)$sid);
my java code for resultset is:
public ResultSet returnResultSet(int id) throws SQLException { Connection conn = null; String SQL = "SELECT SLN, SFN, IDSTUDENT FROM student WHERE idstudent = ?"; conn = dataSource.getConnection(); PreparedStatement ps = conn.prepareStatement(SQL); ps.setInt(1, id); return ps.executeQuery(); }
any insights as to what might be wrong?
Regards,
Larry