Forums Register Login

ResultSet is null

+Pie Number of slices to send: Send
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??
+Pie Number of slices to send: Send
Which driver are you using? An incorrect implementation could be to blame.
+Pie Number of slices to send: Send
 

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



Its type 4.
+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
 

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.
+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
Adeel,
The standard db2 driver is db2java.zip. Does your query work with that driver?
+Pie Number of slices to send: Send
 

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 ]
+Pie Number of slices to send: Send
 

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.
+Pie Number of slices to send: Send
sometime working, sometimes not.
smells like a threading problem, either in your code or within the driver implementation.
How do they get the deer to cross at the signs? Or to read this tiny ad?
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 2277 times.
Similar Threads
ResultSet
How to check record exists
SQLException: No ResultSet
Putting a ResultSet into an Array
execute method in SQl
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 07:50:46.