I am running the following sql statement and receiving this message in the browser:
String find = "select employeeID, dependantID FROM dependant where dependantID = "+ dependantID +";";
Statement stmt3 =con.createStatement();
ResultSet res = stmt3.executeQuery(find);
The variable dependantID is part of the resultSet of a previous SQL statement.
Can anyone suggest how to solve this problem? I have already tried to run the query as:
"select employeeID, dependantID FROM dependant where dependantID = "+rs.getInt("dependantID") +";";
But I got the same error message.
i guess, it was not an error message.
your ResultSet object prints itself
as an java object( like a memory adress )...
you must to retrive data from ResultSet.
Just an idea..
Are you using two resultsets at the same time ? If I try that it fails; the first
resultset is being closed when the other resultset is being retrieved.
The only way I get around that is to use two different java.sql.Statement
objects, one for each of the two queries.
I would be better of you posted the code that fails, and the exception
you get. The snippet you have posted here doesn't tell the whole story.
It the problem is what I am thinking than its very funny. Neverthless its the most commonly made mistake.
1) Before retriving any data from the resultset do res.next() as pointer is placed at -1
2) Do not print res by itself but get the data as res.getInt( 1 ). if you know the column name than do res.getInt( "colname" );
if she is using sockets, wouldn't she be getting an exception because ResultSet does not implement the Serializable Interface. We can not send a ResultSet object through a socket ( as far as i know ) ???
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center