473,395 Members | 1,412 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

JDBC

Ron
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)
Jul 17 '05 #1
1 2334
Ron
Answered my own question by creating a second statement for the second
result set so that my first set would not get closed..... silly me
"Ron" <no*@email.from.here> wrote in message
news:rx*********************@news04.bloor.is.net.c able.rogers.com...
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)

Jul 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: JShurmatz | last post by:
If anyone can shed some light on this problem I would greatly appreciate it. I am unsuccessfully trying to use a database connnection retrieved from a pool configured using Java System Web...
0
by: Nils Valentin | last post by:
Hi MySQL Fans ;-), Is it possible that the 3.08 series allows to connect to 4.0.14 versions but not to the 4.1 alpha-versions ? I get belows error when tryig to connect from DbVisualizer which...
0
by: Robert Mazur | last post by:
MySQL 5.0 alpha (binary install) on Solaris 9 -or- RedHat 8.0 mysql-connector-java-3.0.8-stable ----------------------- Is there something different going on with JDBC and the alpha version...
0
by: Bing | last post by:
Hi, I am configuring the same DB2 v8.1 JDBC universal driver (db2jcc.jar and db2jcc_license_cisuz.jar) from DB2 SP5 fix pack under WSAD 5.1.x environment and WebSphere application Server 5.0.2...
0
by: Raquel | last post by:
UDB PE 8.1 on Win XP. Per the manual: DB2 JDBC traces always begin with a header that lists important system information such as key environment variable settings, the JDK or JRE level, the...
1
by: Praveen | last post by:
Hi, I have installed WebSphere Portal on AIX and connected to DB2 on a remote machine, Getting the followin errors when trying to get the values from database thru applications installed on...
1
by: rpm45tech | last post by:
Hi everyone. I'm deveolping in Java with DB2 running on Win XP and everything was working ok but then I installed Vista Ultimate and the application stopped working. This is the exception showed: ...
2
by: bevis | last post by:
I'm new to sql server and mysql but this seems like it should be a pretty straight forward jdbc connection. But I have spent almost 2 days just trying to get a jdbc connection. Please help if you...
3
by: Anoop | last post by:
Is it true that there are no type 4 jdbc drivers to connect to a DB2 server v7.1? The DB2 server is hosted on ACF2 (OS/390). We would be connecting from windows and solaris boxes. If it is true,...
0
by: Jim Kennedy | last post by:
ALL DDL does a commit. Hence Drop Table movies; issues a commit. True you don't issue a commit and the driver does not issue a commit, but the server does for all DDL. That is probably where...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.