473,761 Members | 5,578 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.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)
Jul 17 '05 #1
1 2354
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******** *************@n ews04.bloor.is. net.cable.roger s.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.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)

Jul 17 '05 #2

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

Similar topics

0
4495
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 Server 6.1 with the SQL Server 2000 JDBC Driver. The background: 1. I have downloaded the SQL Server 2000 JDBC Driver and installed it on the web server.
0
2268
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 was working fine until a while ago. I haven't watched it recently, and haven't changed anything I am aware off right now. After I realized the problem I tried many 3.08 versions with the same symptom. Watch were it says "Unknown system variable...
0
4245
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 of MySQL 5.0? When trying to connect I am getting: ** BEGIN NESTED EXCEPTION **
0
3083
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 on Windows 2000 machines. I configured a connection pool data source using type 4 for a local test environment in WSAD 5.1.x, and a connection pool data source on the WebSphere Server too. Both data sources are accessing the same database.
0
3333
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 DB2 JDBC driver level, and the DB2 build level. For example: 1 ======================================================== 2 | Trace beginning on 2002-1-28 7:21:0.19
1
9030
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 Portal. Any Help Appreciated. Thanks in advance. Praveen Singh
1
8803
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: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class 'COM.ibm.db2.jdbc.app.DB2Driver' for connect URL...
2
4559
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 can. I'm using Eclipse 3.2.2 and I have installed mysql-connector-java-5.0.6-bin.jar. I am trying to connect to SQL Enterprise Manager version 8.0 innstall on a Windows 2003 Server Enterprise Edition. I have been able to successfully test...
3
22839
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, what are my options? Will I have to install db2 connect on every client machine that needs to connect to the DB2 servers? Is the DB2 Connect freely available or will we have to purchase it? I have also read on this group that we can install DB2...
0
604
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 your commit is coming from. Jim -- Replace part of the email address: kennedy-down_with_spammers@attbi.com with family. Remove the negative part, keep the minus sign. You can figure it out.
0
9538
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10123
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9909
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8794
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7342
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6623
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5241
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3889
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3481
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.