[Mono-dev] IBM.Data.DB2.DB2Exception: Unable to allocate statement handle

Daniel Morgan monodanmorg at yahoo.com
Thu Feb 12 11:58:59 EST 2009


IBM does not provide an IBM.Data.DB2.dll assembly for Linux.  IBM only provides IBM.Data.DB2.dll for Windows.  This goes the same with other proprietary database management systems out there, such as, Oracle and Sybase.  These companies only support Microsoft .net framework - they do not even acknowledge Mono.

Mono provides a homemade IBM.Data.DB2.dll assembly, but it is not maintained.

I cannot see what is available on Linux right now, but I can see what the Mono Windows installer installs.  Mono only installs IBM.Data.DB2.dll for the 1.0 profile.  The assembly is not built for the 2.0 profile.

I suggest using System.Data.Odbc instead.  Novell does maintain System.Data.Odbc, and IBM does have an ODBC driver for DB2 on Linux.

--- On Thu, 2/12/09, Carlos Ruiz Diaz <carlos.ruizdiaz at gmail.com> wrote:

> From: Carlos Ruiz Diaz <carlos.ruizdiaz at gmail.com>
> Subject: Re: [Mono-dev] IBM.Data.DB2.DB2Exception: Unable to allocate statement handle
> To: "Bartolomeo Nicolotti" <bnicolotti at siapcn.it>
> Cc: mono-devel-list at lists.ximian.com
> Date: Thursday, February 12, 2009, 10:46 AM
> After failing trying to connect with the native driver I
> switched to
> unixODBC and it works fine for me. It is stable and I
> currently have a large
> program using ODBC as its connector.
> I use openSuse as my major OS. I installed the db2 express
> C but I was
> unable to find the required library to make IBM.DB2 dll to
> work. Bad for me.
> 
> 
> 
> 
> On Thu, Feb 12, 2009 at 4:20 AM, Bartolomeo Nicolotti
> <bnicolotti at siapcn.it>wrote:
> 
> >
> > I'd like to use the webservice "As is"
> so that we can switch easyly...
> >
> > if I won't be able to do it with IBM.Data.DB2 in a
> few days I'll consider
> > using other way to connect.
> >
> > Do you know if with these providers you can connecto
> to AS/400?
> >
> > Many thanks
> >
> > Best regards
> >
> >
> >
> > Bartolomeo Nicolotti wrote:
> > >
> > > Da:   Daniel Morgan <monodanmorg at yahoo.com>
> > >
> > > Have you considered using ODBC provider instead?
> > >
> > > System.Data.Odbc namespace is included in
> System.Data assembly.
> > >
> > > You can use iodbc or unixodbc on linux. 
> There's commercial odbc
> > solutions
> > > for linux too.
> > >
> > > http://mono-project.com/ODBC
> > >
> > > http://www.unixodbc.com/doc/db2.html
> > >
> > > Novell maintains System.Data.Odbc; however, I do
> not think anyone is
> > > maintaining IBM.Data.DB2 in Mono.
> > >
> > >
> > > --- On Wed, 2/11/09, Bartolomeo Nicolotti
> <bnicolotti at siapcn.it> wrote:
> > >
> > >
> > >
> > > Bartolomeo Nicolotti wrote:
> > >>
> > >> IBM.Data.DB2.DB2Exception: Unable to allocate
> statement handle
> > >>
> > >> by Bartolomeo Nicolotti :: Rate this Message:
> > >>
> > >> Reply | Reply to Author | View Threaded |
> Show Only this Message
> > >> Hello,
> > >>
> > >> I've installed mono, and xsp (not yet
> mod_mono) on ubuntu following the
> > >> instruction here:
> > >>
> > >>
> http://ubuntuforums.org/showthread.php?t=803743
> > >>
> > >> in view of using mod_mono together with php
> on ubuntu server 8.04, to
> > >> migrate a web service that access a db2/as400
> database.
> > >>
> > >> I've also installed db2exc from ubuntu
> repository as said here:
> > >>
> > >> http://www.ubuntu.com/partners/ibm/db2
> > >>
> > >> I can compile a test program that does a
> query to the db:
> > >>
> > >> 
> http://www.nabble.com/file/p21953488/helloDB2.cs helloDB2.cs
> > >>
> > >> siap at LxPC54:~/src/test$ gmcs
> -r:/usr/lib/mono/1.0/IBM.Data.DB2.dll
> > >> -r:/usr/lib/mono/2.0/System.Data.dll
> helloDB2.cs
> > >>
> > >> but when I execute it:
> > >>
> > >> siap at LxPC54:~/src/test$ sudo
> MONO_LOG_LEVEL=debug mono helloDB2.exe
> > bart
> > >>
> > >> ....
> > >>
> > >> Mono-INFO: Assembly Ref addref System.Data
> 0x8362e10 -> System.Xml
> > >> 0x83719d8: 2
> > >>
> > >> Hello, bart
> > >> Mono-INFO: DllImport attempting to load:
> 'libdb2'.
> > >> Mono-INFO: DllImport loading location:
> 'libdb2.so'.
> > >> Mono-INFO: Searching for
> 'SQLAllocHandle'.
> > >> Mono-INFO: Probing 'SQLAllocHandle'.
> > >> Mono-INFO: Found as 'SQLAllocHandle'.
> > >> Mono-INFO: DllImport attempting to load:
> 'libdb2'.
> > >> Mono-INFO: DllImport loading location:
> 'libdb2.so'.
> > >> Mono-INFO: Searching for
> 'SQLAllocHandle'.
> > >> Mono-INFO: Probing 'SQLAllocHandle'.
> > >> Mono-INFO: Found as 'SQLAllocHandle'.
> > >> Bart
> > >> not useLibCli
> > >> Bart
> > >> not useLibCli
> > >> Mono-INFO: DllImport attempting to load:
> 'libdb2'.
> > >> Mono-INFO: DllImport loading location:
> 'libdb2.so'.
> > >> Mono-INFO: Searching for
> 'SQLDriverConnectW'.
> > >> Mono-INFO: Probing
> 'SQLDriverConnectWW'.
> > >> Mono-INFO: Probing
> 'SQLDriverConnectWW'.
> > >> Mono-INFO: Probing
> 'SQLDriverConnectW'.
> > >> Mono-INFO: Found as
> 'SQLDriverConnectW'.
> > >> Mono-INFO: DllImport attempting to load:
> 'libdb2'.
> > >> Mono-INFO: DllImport loading location:
> 'libdb2.so'.
> > >> Mono-INFO: Searching for
> 'SQLDriverConnectW'.
> > >> Mono-INFO: Probing
> 'SQLDriverConnectWW'.
> > >> Mono-INFO: Probing
> 'SQLDriverConnectWW'.
> > >> Mono-INFO: Probing
> 'SQLDriverConnectW'.
> > >> Mono-INFO: Found as
> 'SQLDriverConnectW'.
> > >> Mono-INFO: DllImport attempting to load:
> 'libdb2'.
> > >> Mono-INFO: DllImport loading location:
> 'libdb2.so'.
> > >> Mono-INFO: Searching for
> 'SQLGetInfoW'.
> > >> Mono-INFO: Probing 'SQLGetInfoWW'.
> > >> Mono-INFO: Probing 'SQLGetInfoWW'.
> > >> Mono-INFO: Probing 'SQLGetInfoW'.
> > >> Mono-INFO: Found as 'SQLGetInfoW'.
> > >> Mono-INFO: DllImport attempting to load:
> 'libdb2'.
> > >> Mono-INFO: DllImport loading location:
> 'libdb2.so'.
> > >> Mono-INFO: Searching for
> 'SQLGetInfoW'.
> > >> Mono-INFO: Probing 'SQLGetInfoWW'.
> > >> Mono-INFO: Probing 'SQLGetInfoWW'.
> > >> Mono-INFO: Probing 'SQLGetInfoW'.
> > >> Mono-INFO: Found as 'SQLGetInfoW'.
> > >> Mono-INFO: DllImport attempting to load:
> 'libdb2'.
> > >> Mono-INFO: DllImport loading location:
> 'libdb2.so'.
> > >> Mono-INFO: Searching for
> 'SQLGetDiagRec'.
> > >> Mono-INFO: Probing 'SQLGetDiagRec'.
> > >> Mono-INFO: Found as 'SQLGetDiagRec'.
> > >> Mono-INFO: DllImport attempting to load:
> 'libdb2'.
> > >> Mono-INFO: DllImport loading location:
> 'libdb2.so'.
> > >> Mono-INFO: Searching for
> 'SQLGetDiagRec'.
> > >> Mono-INFO: Probing 'SQLGetDiagRec'.
> > >> Mono-INFO: Found as 'SQLGetDiagRec'.
> > >> Bart
> > >> not useLibCli
> > >>
> > >> Unhandled Exception:
> IBM.Data.DB2.DB2Exception: ERROR [08003] [IBM][CLI
> > >> Driver] CLI0106E  Connection is closed.
> SQLSTATE=08003
> > >> InternalExecuteNonQuery: Unable to allocate
> statement handle.
> > >>   at
> IBM.Data.DB2.DB2Command.AllocateStatement (System.String
> location)
> > >> [0x00000]
> > >>   at
> IBM.Data.DB2.DB2Command.ExecuteNonQueryInternal
> (CommandBehavior
> > >> behavior) [0x00000]
> > >>   at IBM.Data.DB2.DB2Command.ExecuteReader
> (CommandBehavior behavior)
> > >> [0x00000]
> > >>   at IBM.Data.DB2.DB2Command.ExecuteReader ()
> [0x00000]
> > >>   at (wrapper remoting-invoke-with-check)
> > >> IBM.Data.DB2.DB2Command:ExecuteReader ()
> > >>   at HelloWorldDb2.Main (System.String[]
> args) [0x00000]
> > >>
> > >
> > >
> >
> > --
> > View this message in context:
> >
> http://www.nabble.com/IBM.Data.DB2.DB2Exception%3A-Unable-to-allocate-statement-handle-tp21953488p21971698.html
> > Sent from the Mono - Dev mailing list archive at
> Nabble.com.
> >
> > _______________________________________________
> > Mono-devel-list mailing list
> > Mono-devel-list at lists.ximian.com
> >
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
> >
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list


      


More information about the Mono-devel-list mailing list