• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

ResultSet is null

 
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm using db2jcc driver to connect with DB2. It is giving me a null ResultSet object. It shouldn't be like that. Execution never returns null as ResultSet object. Below is my code.




Javadocs says:

public ResultSet executeQuery() throws SQLException

Executes the SQL query in this PreparedStatement object and returns the ResultSet object generated by the query.

Returns:
a ResultSet object that contains the data produced by the query; never null
Throws:
SQLException - if a database access error occurs or the SQL statement does not return a ResultSet object



Any inputs??
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which driver are you using? An incorrect implementation could be to blame.
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by David O'Meara:
Which driver are you using? An incorrect implementation could be to blame.



Its type 4.
 
author & internet detective
Posts: 40200
816
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Adeel,
I think Dave meant more specifics about the driver. What company made it? What is it called?

I definitely agree with him that it is a problem in the driver. You are both correct that executeQuery() never returns null.
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Jeanne Boyarsky:
I think Dave meant more specifics about the driver. What company made it? What is it called?



Hi Jeanne.

Dont know much about the driver. Infact I haven't downloaded this myself. This is given by one of my work place colleague. The file called db2jcc.jar and I am using type 4 driver. I have tried to get more information by seeing its properties. WindowsXP is showing me nothing, but the date modified, created, etc.

Packages are like below.

- com.ibm.db2.jcc.sqlj
- com.ibm.db2.jcc.uw
- com.ibm.db2.jcc.t2
- com.ibm.db2.jcc.resources
- com.ibm.db2.jcc.a
- com.ibm.db2.jcc.b
- com.ibm.db2.jcc.c

Please notice last three packages I have mentioned above. What kind of name is this? It has class files like

a.class
b.class
c.class
.
.
.
z.class

After using all the english alphabets, the name are the combinations of alphabets like

bu.class
bc.class
bt.class

Its not following the naming conventions even. The class name should be with initCap.
 
author
Posts: 4223
33
jQuery Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My feeling is that there is some other error going on other than the null pointer and the null pointer is masking the real problem. Do you know if the query generated works? I'd try moving things into isolation and run simpler queries like "select * from ..." until you've worked out the kinks.
 
Jeanne Boyarsky
author & internet detective
Posts: 40200
816
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Adeel,
The standard db2 driver is db2java.zip. Does your query work with that driver?
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Jeanne Boyarsky:
The standard db2 driver is db2java.zip. Does your query work with that driver?



Yes. But as far as I know we need to install the DB2 Client in order to use db2java.zip. Even I install the client prior to use that driver. What you say?
[ November 21, 2005: Message edited by: Adeel Ansari ]
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Scott Selikoff:
My feeling is that there is some other error going on other than the null pointer and the null pointer is masking the real problem. Do you know if the query generated works? I'd try moving things into isolation and run simpler queries like "select * from ..." until you've worked out the kinks.



I have tried all the stuff. But the problem is in the driver. Sometimes it gives null as a result of a query. And sometimes it fetches the record fine for against the same query. And sometimes it says no record found, although there are some records in there.
 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sometime working, sometimes not.
smells like a threading problem, either in your code or within the driver implementation.
 
Consider Paul's rocket mass heater.
    Bookmark Topic Watch Topic
  • New Topic