Well, I talked on the phone with IBM's .net Support. And the cwbx definitely does not do any kind of pooling. It's a batch/queue setup. So multiple calls into the dll will stack up one after the other until they are all done.
To get around this I created a simple Object Pool, that would instanciate the object's connection to the 400, and then when I need the object, get it from the pool, use it and return it. Pretty slick!
As for the connecitons on the 400, they just sit in a status of TIMW until they are used. I do have a limit on the number of connections in the pool, so if I get too many in there, I close the oldest one down.
Showing posts with label iSeries. Show all posts
Showing posts with label iSeries. Show all posts
Monday, February 25, 2008
Thursday, February 14, 2008
cwbx help files
Well, I wrote an application that I was getting the objectdisposed exception in, and that was using IBMs .net provider to talk to the as400, call a stored proc which called a program.
Unfortunately, that wasn't fast enough for me, so I started searching around for help on calling programs directly. I found a dll, that you can reference in your project, which will give you access to calling 400 programs directly. This opens up a whole new world because you can start passing complex types back and forth (suposedly, I haven't tried this myself). The downside, is that there is only one real other blog that actually has info on it.
http://www.netsplore.com/PublicPortal/blog.aspx?EntryID=13
And the program works great. However, I needed to know what some of the values mean, because even though this method is faster than the .net provider, i'm still slower than running websphere for the same calls.
It took some reasearch, but for all you out there, who need to know, you can find the cwbx.dll help files in the following directory on your windows system:
Unfortunately, that wasn't fast enough for me, so I started searching around for help on calling programs directly. I found a dll, that you can reference in your project, which will give you access to calling 400 programs directly. This opens up a whole new world because you can start passing complex types back and forth (suposedly, I haven't tried this myself). The downside, is that there is only one real other blog that actually has info on it.
http://www.netsplore.com/PublicPortal/blog.aspx?EntryID=13
And the program works great. However, I needed to know what some of the values mean, because even though this method is faster than the .net provider, i'm still slower than running websphere for the same calls.
It took some reasearch, but for all you out there, who need to know, you can find the cwbx.dll help files in the following directory on your windows system:
C:\Program Files\IBM\Client Access\Mri2924\cwbx.hlp
that last directory having to do something with the version of your client access.....
This basically a help file on what all the values, types, methods, objects, etc mean for that dll.
objectdisposedexception Fixed!
I found the problem, and posted the solution on a comment field in one of the previous posts. But here it is. Our server was running the latest fixes, however, my client access was not updated to the latest service pack. Our Operations manager, gave me this link to IBMs site to install the service pack on my local windows machine, and it works.
ftp://ftp.software.ibm.com/as400/products/clientaccess/win32/
Then select v5r4m0 (or what ever version you are running), servicepack, and si29771.
Download si29771.exe and run it on your system. Poof! Now you no longer get the objectdisposedexception, and no more errors with ThreadPool.RegisterWaitForSingleObject
Hope this helps!
ftp://ftp.software.ibm.com/as400/products/clientaccess/win32/
Then select v5r4m0 (or what ever version you are running), servicepack, and si29771.
Download si29771.exe and run it on your system. Poof! Now you no longer get the objectdisposedexception, and no more errors with ThreadPool.RegisterWaitForSingleObject
Hope this helps!
Friday, January 11, 2008
SSIS, AS400 and the System.Byte[]
So, I have an SSIS package that I'm wanting to create. When I use the ODBC connection (similar in the DTS), I can pull everything over fine. I have 2 fields, one is a Char(3) the other a Char(13) on the 400. I've made the exact table in my sql server db.
The problem is that if I use the ole for .net instead of odbc, I get the following Error when I switch the provider in the SSIS package:

I'm using the IBMDA400 OLEdb\IBM DB2 UDB for iSeries when I get the error
I'm not having this problem with any other of my SSIS packages... wierd.
The problem is that if I use the ole for .net instead of odbc, I get the following Error when I switch the provider in the SSIS package:
I'm using the IBMDA400 OLEdb\IBM DB2 UDB for iSeries when I get the error
I'm not having this problem with any other of my SSIS packages... wierd.
Monday, December 31, 2007
objectdisposedexception - Safe handle has been closed Pt 3
I don't know if this will help in the error, but I did come across a reference to add to the app.config of your app to set the following flag. This may mask other errors, and I haven't tested it out yet. But it is one more option to add:
legacyunhandledexceptionpolicy enabled="1"
Under the config section of the app.config.
legacyunhandledexceptionpolicy enabled="1"
Under the config section of the app.config.
objectdisposedexception - Safe handle has been closed Pt. 2
In doing some more research, I found this bit from a Microsoft Feedback page:
It sounds like this is the only case that you should not call the disposed method. Instead, let program clean it up on it's own. Yuck.
The issue reported to us occurs not because the iDB2NamedEvent class calls the Handle property, but because it calls it while the WaitHandle is registered with the ThreadPool through ThreadPool.RegisterWaitForSingleObject. This is not a valid operation.
The workaround is either to avoid closing the handle manually in the finalizer for the iDB2NamedEvent class (the runtime will take care of that anyway), or unregister the WaitHandle from the ThreadPool before closing the handle. Option 1 is probably preferable.
It sounds like this is the only case that you should not call the disposed method. Instead, let program clean it up on it's own. Yuck.
Friday, December 28, 2007
objectdisposedexception - Safe handle has been closed
It's been a while since I've posted, and here is my current issue. I'm writting a call from an asp.net webservice to an IBM as/400 storedproc via IBM's "IBM DB2 UDB for iSeries .NET Provider"
It works great! I have a stored procedure on the iSeries system that calls an internal program. I can make the call. However, when my project stops or closes down, I get an ObjectDisposedException, "Safe handle has been closed" I've seen a few posts here and there about it, and finally stumbled across this bit from IBM:
SE22506 - CA400EXP-IDB2DATA .NET PROVIDER WITH .NET FRAMEWORK 2.0
At least they have a patch. Though, I don't know how long it will take our team to get the patch installed, tested and move to production. Well, hopefully it won't take long.
But in any case, at least now I have a path to go down. And according to their records it will work on V5R2M0, V5R3M0, and V5R4M0. We'll see I guess.
If anyone has some other method for working around this error, I'd love to hear about it.
It works great! I have a stored procedure on the iSeries system that calls an internal program. I can make the call. However, when my project stops or closes down, I get an ObjectDisposedException, "Safe handle has been closed" I've seen a few posts here and there about it, and finally stumbled across this bit from IBM:
SE22506 - CA400EXP-IDB2DATA .NET PROVIDER WITH .NET FRAMEWORK 2.0
At least they have a patch. Though, I don't know how long it will take our team to get the patch installed, tested and move to production. Well, hopefully it won't take long.
But in any case, at least now I have a path to go down. And according to their records it will work on V5R2M0, V5R3M0, and V5R4M0. We'll see I guess.
If anyone has some other method for working around this error, I'd love to hear about it.
Subscribe to:
Posts (Atom)
