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.createSt atement(ResultS et.TYPE_SCROLL_ INSENSITIVE,
ResultSet.CONCU R_UPDATABLE);
ResultSet Picks = stmt.executeQue ry("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.getS tring(5);
PlayerOrGoalie= Picks.getString (4)=="G"? "goalie":"playe r"; //select
the table goalie, or player
Test="Select WeekOpenScore, CurrentScore from "+PlayerOrGoali e+" where
name ='"+name+"'";
System.out.prin tln(Test); //shows the query for debugging
ScoreCalc =stmt.executeQu ery(Test);
System.out.prin tln("1"); //verifys that the above line is processed;
ScoreCalc.first ();
System.out.prin tln("2"); //verifys that the above line is processed;
Picks.updateInt ("Score",ScoreC alc.getInt(2)-ScoreCalc.getIn t(1));
System.out.prin tln("3"); //verifys that the above line is processed;
Picks.updateRow ();
System.out.prin tln("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.NullP ointerException
at com.mysql.jdbc. UpdatableResult Set.refreshRow( UpdatableResult Set.java:628)
at com.mysql.jdbc. UpdatableResult Set.updateRow(U pdatableResultS et.java:1542)
at Hockey2003.main (Hockey2003.jav a:113)
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.createSt atement(ResultS et.TYPE_SCROLL_ INSENSITIVE,
ResultSet.CONCU R_UPDATABLE);
ResultSet Picks = stmt.executeQue ry("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.getS tring(5);
PlayerOrGoalie= Picks.getString (4)=="G"? "goalie":"playe r"; //select
the table goalie, or player
Test="Select WeekOpenScore, CurrentScore from "+PlayerOrGoali e+" where
name ='"+name+"'";
System.out.prin tln(Test); //shows the query for debugging
ScoreCalc =stmt.executeQu ery(Test);
System.out.prin tln("1"); //verifys that the above line is processed;
ScoreCalc.first ();
System.out.prin tln("2"); //verifys that the above line is processed;
Picks.updateInt ("Score",ScoreC alc.getInt(2)-ScoreCalc.getIn t(1));
System.out.prin tln("3"); //verifys that the above line is processed;
Picks.updateRow ();
System.out.prin tln("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.NullP ointerException
at com.mysql.jdbc. UpdatableResult Set.refreshRow( UpdatableResult Set.java:628)
at com.mysql.jdbc. UpdatableResult Set.updateRow(U pdatableResultS et.java:1542)
at Hockey2003.main (Hockey2003.jav a:113)
Comment