[Mono-list] IBM.Data.DB2 on ubuntu

Bartolomeo Nicolotti bnicolotti at siapcn.it
Tue Feb 10 14:05:07 EST 2009




Bartolomeo Nicolotti wrote:
> 
> 
> 
> Bartolomeo Nicolotti wrote:
>> 
>> 
>> 
>> Bojan Rajkovic wrote:
>>> 
>>> You're forgetting to add a reference to IBM.Data.DB2.dll on the gmcs
>>> command
>>> line.
>>> 
>>> You should be compiling your code as follows: gmcs
>>> -r:/usr/lib/mono/1.0/IBM.Data.DB2.dll helloDB2.cs.
>>> If your Mono libs are installed somewhere different (if you compiled
>>> from
>>> source, they may be in /usr/local/lib/mono), you'll need to change that
>>> part
>>> of the path.
>>> 
>>> --Bojan
>>> 
>>> -----Original Message-----
>>> From: mono-list-bounces at lists.ximian.com
>>> [mailto:mono-list-bounces at lists.ximian.com] On Behalf Of Bartolomeo
>>> Nicolotti
>>> Sent: Tuesday, February 10, 2009 12:20 PM
>>> To: mono-list at lists.ximian.com
>>> Subject: [Mono-list] IBM.Data.DB2 on ubuntu
>>> 
>>> 
>>> Hi,
>>> 
>>> I've installed mono, and xsp (not yet mod_mono) 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.
>>> 
>>> This is to migrate a web service that access a db2 database.
>>> 
>>> I've also installed db2exc from ubuntu repository as said here:
>>> 
>>> http://www.ubuntu.com/partners/ibm/db2
>>> 
>>> and as said here:
>>> 
>>> http://www.mail-archive.com/mono-devel-list@lists.ximian.com/msg02323.html
>>> 
>>> I've added the library path with the command:
>>> 
>>> sudo /sbin/ldconfig /opt/ibm/db2exc/V9.5/lib32
>>> 
>>> But if I try to compile a file that makes use of the namespace
>>> IBM.Data.DB2
>>> I got:
>>> 
>>> siap at LxPC54:~/src/test$ gmcs helloDB2.cs 
>>> helloDB2.cs(2,14): error CS0234: The type or namespace name `Data' does
>>> not
>>> exist in the namespace `System'. Are you missing an assembly reference?
>>> helloDB2.cs(3,7): error CS0246: The type or namespace name `IBM' could
>>> not
>>> be found. Are you missing a using directive or an assembly reference?
>>> Compilation failed: 2 error(s), 0 warnings
>>> 
>>> 
>>> could someone help me?
>>> 
>>> Many thanks 
>>> 
>>> Best regards
>>> -- 
>>> View this message in context:
>>> http://www.nabble.com/IBM.Data.DB2-on-ubuntu-tp21937603p21937603.html
>>> Sent from the Mono - General mailing list archive at Nabble.com.
>>> 
>>> _______________________________________________
>>> Mono-list maillist  -  Mono-list at lists.ximian.com
>>> http://lists.ximian.com/mailman/listinfo/mono-list
>>> 
>>> 
>>> _______________________________________________
>>> Mono-list maillist  -  Mono-list at lists.ximian.com
>>> http://lists.ximian.com/mailman/listinfo/mono-list
>>> 
>>> 
>> 
>> 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 
>> siap at LxPC54:~/src/test$ mono helloDB2.exe 
>> You must tell me your name!
>> siap at LxPC54:~/src/test$ mono helloDB2.exe bart
>> Hello, bart
>> 
>> Unhandled Exception: System.DllNotFoundException: db2_36
>>   at (wrapper managed-to-native)
>> IBM.Data.DB2.DB2CLIWrapper/StaticWrapper36:SQLAllocHandle
>> (int16,intptr,intptr&)
>>   at IBM.Data.DB2.DB2CLIWrapper.SQLAllocHandle (Int16 handleType, IntPtr
>> inputHandle, System.IntPtr& outputHandle) [0x00000] 
>>   at IBM.Data.DB2.DB2CLIWrapper.Initialize (System.IntPtr& pEnvHandle)
>> [0x00000] 
>>   at IBM.Data.DB2.DB2Environment..ctor () [0x00000] 
>>   at IBM.Data.DB2.DB2Environment.get_Instance () [0x00000] 
>>   at IBM.Data.DB2.DB2ConnectionPool.FindConnectionPool (System.String
>> connectionString) [0x00000] 
>>   at IBM.Data.DB2.DB2ConnectionSettings.GetConnectionSettings
>> (System.String connectionString) [0x00000] 
>>   at IBM.Data.DB2.DB2Connection.SetConnectionString (System.String
>> connectionString) [0x00000] 
>>   at IBM.Data.DB2.DB2Connection..ctor (System.String conString) [0x00000] 
>>   at (wrapper remoting-invoke-with-check)
>> IBM.Data.DB2.DB2Connection:.ctor (string)
>>   at HelloWorldDb2.Main (System.String[] args) [0x00000] 
>> 
>> 
>> 
> 
> sudo vim /etc/mono/config
> 
>         <dllmap dll="oci" target="libclntsh.so" os="!windows"/>
>         <dllmap dll="db2cli" target="libdb2_36.so" os="!windows"/>
>         <dllmap dll="db2_36" target="libdb2.so" os="!windows"/>
>  
> 

siap at LxPC54:~/src/mono/mono-2.2/mcs/class/IBM.Data.DB2/IBM.Data.DB2$ vim
DB2CLIWrapper.cs 


                public class StaticWrapper36
                {
                        private const string libname = "db2_36";

                        [DllImport(libname, EntryPoint = "SQLAllocHandle")]
                        public static extern short SQLAllocHandle(short
handleType, IntPtr inputHandle,  out IntPtr outputHandle);
                        [DllImport(libname, EntryPoint = "SQLFreeHandle")]
                        public static extern short SQLFreeHandle(short
handleType, IntPtr inputHandle);

....

siap at LxPC54:/usr/local/lib/xsp/test$ nm
/opt/ibm/db2exc/V9.5/lib32/libdb2.so.1  | grep SQLAllocHandle
001dadd4 T SQLAllocHandle
00d28bec d SQLAllocHandle$$LSDA

00d2d260 d SQLGetDiagRecW$$LSDA
002716d8 T
_Z14SQLGetDiagRec2P19CLI_ERRORHEADERINFOiPhPiS1_sPshhP17CLI_STATEMENTINFO
00d2ae78 d
_Z14SQLGetDiagRec2P19CLI_ERRORHEADERINFOiPhPiS1_sPshhP17CLI_STATEMENTINFO$$LSDA

-- 
View this message in context: http://www.nabble.com/IBM.Data.DB2-on-ubuntu-tp21937603p21939496.html
Sent from the Mono - General mailing list archive at Nabble.com.



More information about the Mono-list mailing list