Error in java sql
I am running the following code in JSP and I am receiving the error message:
"sun.jdbc.odbc.JdbcOdbcResultSet@1627086 "
String sql1 = "SELECT employeeID, groupPolicyNo FROM employee WHERE employeeID = 9;";
Statement stmtAdmin =con.createStatement();
ResultSet res = stmtAdmin.executeQuery(sql1);
out.println(res);
// the next query finds all the employees who have that group policy no.
String sql2 = "SELECT employeeID, groupPolicyNo FROM employee WHERE groupPolicyNo = "+res+" ;";
Statement stmt =con.createStatement();
ResultSet rs = stmt.executeQuery(sql2);
out.println(rs);
These queries are running perfectly in the database but not on the browser,
Can any one shed some light?
:o
# 1 Re: Error in java sql
I assume that you are using an Applet in the browser? And it is running in the browser's Java plugin.
If so, there might be error messages in the browser's Java console. Find the browser's menuitem that displays the Java console and copy the error messages from there to here.
Norm at 2007-11-11 22:39:57 >

# 2 Re: Error in java sql
I may be missing some features here... but it seems to me that you are concatenating
the string representation of a ResultSet instance to your second query string :confused:.
I would code it like:
// the next query finds all the employees who have that group policy no.
String sql2 = "SELECT employeeID, groupPolicyNo FROM employee WHERE groupPolicyNo = "+res.getString("groupPolicyNo")+" ;";
And whats with that semicolon inside the query string ?
sjalle at 2007-11-11 22:41:02 >
