Menu

#1 transfer resultset

1.0
open
Saoudi
None
2014-07-03
2014-07-03
No

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

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.