Re: NPE on ResultSet update
Posted by: Rusty Wright
Date: December 11, 2004 08:16PM

I tested my code with mysql-4.0.21 and I get the NPE there as well.

Exception in thread "main" java.lang.NullPointerException
at com.mysql.jdbc.UpdatableResultSet.syncUpdate(
at com.mysql.jdbc.UpdatableResultSet.updateString(
at com.mysql.jdbc.UpdatableResultSet.updateString(
at DB.db_update(
at Waitlistd.server(
at Waitlistd.main(

Here is my code:

st = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,
sql = "select * from waitlistd where host='" + host + "';";
rs = st.executeQuery(sql);

// jdbc doesn't seem to have a rowCount() function to
// tell you how many rows were retrieved, but last()
// returns false if there are no rows in the result set.
if (! rs.last()) {
db_insert(con, fpu, host);


// re-run the query so we're on the right row for
// the following updates.
rs = st.executeQuery(sql);

if (fpu.get_Logon())
rs.updateString("type", "on");
rs.updateString("type", "off");

if ((sid = fpu.get_SID()) != null)
rs.updateString("kps", sid);

Options: ReplyQuote

Written By
December 11, 2004 07:52PM
Re: NPE on ResultSet update
December 11, 2004 08:16PM
December 11, 2004 08:43PM
December 12, 2004 10:56AM
December 12, 2004 12:13PM
December 12, 2004 02:06PM
December 12, 2004 02:24PM
December 12, 2004 11:07AM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.