|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
DB2 and OLEDBDataReaderI 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? 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). Show quote "Dirk Behnke" wrote: > 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? > MrSmersh wrote:
Show quote > First what version of DB2 you are attempting to use. There are subtle I'm using DB2 8.1 on Windows> 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). > > > "Dirk Behnke" wrote: > > >>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? >> 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. Show quote "Dirk Behnke" wrote: > MrSmersh wrote: > > 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). > > > > > > "Dirk Behnke" wrote: > > > > > >>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? > >> > I'm using DB2 8.1 on Windows > |
|||||||||||||||||||||||