this code is giving me an excption and I cannot tell why could someone who
is familiar with jdbc help me out, I am using mysql with jdbc, although the
exception does not look like it is getting far enough for that to matter.
Statement stmt = PoolDB.createStatement(ResultSet.TYPE_SCROLL_INSEN SITIVE,
ResultSet.CONCUR_UPDATABLE);
ResultSet Picks = stmt.executeQuery("SELECT * FROM picks where
week="+week); // get all the cloums and keys so the rows are updateable
ResultSet ScoreCalc; //for lookups to another table
String PlayerOrGoalie; //to determine wich table to look in
String name;
String Test;
while (Picks.next()){ //loop through all the picks
name=Picks.getString(5);
PlayerOrGoalie=Picks.getString(4)=="G"? "goalie":"player"; //select
the table goalie, or player
Test="Select WeekOpenScore, CurrentScore from "+PlayerOrGoalie+" where
name ='"+name+"'";
System.out.println(Test); //shows the query for debugging
ScoreCalc =stmt.executeQuery(Test);
System.out.println("1"); //verifys that the above line is processed;
ScoreCalc.first();
System.out.println("2"); //verifys that the above line is processed;
Picks.updateInt("Score",ScoreCalc.getInt(2)-ScoreCalc.getInt(1));
System.out.println("3"); //verifys that the above line is processed;
Picks.updateRow();
System.out.println("4"); //Output never reaches here
}
gives me this output
Select WeekOpenScore, CurrentScore from player where name ='SomeName'
1
2
3
Exception in thread "main" java.lang.NullPointerException
at com.mysql.jdbc.UpdatableResultSet.refreshRow(Updat ableResultSet.java:628)
at com.mysql.jdbc.UpdatableResultSet.updateRow(Updata bleResultSet.java:1542)
at Hockey2003.main(Hockey2003.java:113)