[Mono-list] DB" connection problem

Niklas.Albers at main-it.de Niklas.Albers at main-it.de
Wed Jan 20 06:00:33 EST 2010


Hi,

I have problems with connecting to a remote db2 database with mono. I am 
using DB2 v.9.5 and mono developer 2.2. The db2 .net data provider and the 
client are allready installed. I also added "<dllmap dll="db2" 
target="libdb2.so" os="!windows"/>" to /etc/mono/config and  the system 
(Suse 11.2) allready knows the lib path of the db2 client.

I try to connect with the following code: 

using System;
using IBM.Data.DB2;

namespace TestDB
{
            class MainClass
    {
        public static void Main(string[] args)
        {
            try
            {
                DB2Connection con = new 
DB2Connection("Server=192.168.69.32;Database=Silva;UID=DBUser;PWD=password;");
                con.Open();
                con.Close();

                Console.WriteLine("Connection Ok");
            }
            catch (Exception e)
            {
                Console.WriteLine(e.ToString());
            }
        }
    }
}

When I run this code, I get the following exception:

IBM.Data.DB2.DB2Exception: No error information
  at IBM.Data.DB2.DB2ClientUtils.DB2CheckReturn (Int16 sqlRet, Int16 
handleType, IntPtr handle, System.String message, 
IBM.Data.DB2.DB2Connection connection) [0x00000] in <filename unknown>:0 
  at IBM.Data.DB2.DB2Environment..ctor () [0x00000] in <filename 
unknown>:0 
  at IBM.Data.DB2.DB2Environment.get_Instance () [0x00000] in <filename 
unknown>:0 
  at IBM.Data.DB2.DB2ConnectionPool.FindConnectionPool (System.String 
connectionString) [0x00000] in <filename unknown>:0 
  at IBM.Data.DB2.DB2ConnectionSettings.GetConnectionSettings 
(System.String connectionString) [0x00000] in <filename unknown>:0 
  at IBM.Data.DB2.DB2Connection.SetConnectionString (System.String 
connectionString) [0x00000] in <filename unknown>:0 
  at IBM.Data.DB2.DB2Connection..ctor (System.String conString) [0x00000] 
in <filename unknown>:0 
  at (wrapper remoting-invoke-with-check) IBM.Data.DB2.DB2Connection:.ctor 
(string)
  at dbhansi.MainClass.Main (System.String[] args) [0x00000] in 
/home/develop/Projects/TestDB/TestDB/Main.cs:12 


The connection string should be correct, in windows it works fine.

Has anybody an idea?

Greetings 

Niklas Albers
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-list/attachments/20100120/59e7a511/attachment.html 


More information about the Mono-list mailing list