DB2 and OLEDBDataReader

D

Dirk Behnke

I have a very strange problem:
I'm connecting ok to a DB2 database
The I'm executing several SQL commands using OleDBDataReader which works
fine.
I'm closing only the reader not the connection after each Reader operation.
Exactly the 1327th ExecuteReader operation triggeres a
NullReferenceException.
Then I close the connection, open it again and the ExecuteReader works!
However again ExecuteReader 1327 -> NullReferenceException.

Any help suggestions?
 
G

Guest

First what version of DB2 you are attempting to use. There are subtle
differences between the iSeries version and the Windows one.

At first glimpse I will try my hand with another data provider, from my
observation on DB2 some are very sensible to the disposing order. First
dispose the reader then the command.
And there are few data providers available form IBM, Microsoft and others,
some native others ODBC and even OleDB. But be warned that providers have
their own idiosyncrasies (in fact you have bumped on one from the OleDB one).
 
D

Dirk Behnke

MrSmersh said:
First what version of DB2 you are attempting to use. There are subtle
differences between the iSeries version and the Windows one.

At first glimpse I will try my hand with another data provider, from my
observation on DB2 some are very sensible to the disposing order. First
dispose the reader then the command.
And there are few data providers available form IBM, Microsoft and others,
some native others ODBC and even OleDB. But be warned that providers have
their own idiosyncrasies (in fact you have bumped on one from the OleDB one).


:
I'm using DB2 8.1 on Windows
 
G

Guest

Ok for this version IBM has released a .Net native provider.
I suggest to try and use him instead of OleDB one, it will be certainly
faster, and as far as I know if you respect the destruction order work fine
even in very demanding applications.
This is what I will recommend, the coding effort is minimal since are booth
implementing the same interface.

Otherwise you will need to isolate the sequence of events that lead to your
problem and see if a problem in your code (try extended exception information
and the database logs) and if not try to avoid that sequence of operations.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top