• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1777
  • Last Modified:

How to install DB2 DbProvider for MONO?

Hi.

I'm trying to run .NET application on Linux (CentOS 6.2 with all latest updates) under MONO (2.10.9).
But the problem is - application cannot find any of DB-providers I'm trying to use.
So, it cannot find System.Data.OleDb and cannot find IBM.Data.DB2.

For OleDb provider it reports error:
20120828,045203.30 [T6]  Monitor[test2].JobsPool:DataSource[Q.RecordCounters]->Error(System.DllNotFoundException): gda-2 at   at (wrapper managed-to-native) System.Data.OleDb.libgda:gda_init (string,string,int,string[])
  at System.Data.OleDb.OleDbConnection.Open () [0x00000] in <filename unknown>:0 
  at MonitoringDM.MonitoringDataConnection.GetConnection () [0x00000] in <filename unknown>:0 
  at MonitoringDM.Monitor.refreshSqlDs (MonitoringDM.MonitoringDataSource pDS) [0x00000] in <filename unknown>:0 
  at MonitoringDM.Monitor.refreshDataSource (System.Object state) [0x00000] in <filename unknown>:0 

Open in new window


For IBM.Data.DB2 it reports a bit different error:
20120828,045203.31 [T6]  Monitor[test1].JobsPool:DataSource[Errors.TotalCount]->Error(System.Configuration.ConfigurationErrorsException): Failed to find or load the registered .Net Framework Data Provider 'IBM.Data.DB2'. at   at System.Data.Common.DbProviderFactories.GetFactory (System.String providerInvariantName) [0x00000] in <filename unknown>:0 
  at MonitoringDM.MonitoringDataConnection.GetDbFactory () [0x00000] in <filename unknown>:0 
  at MonitoringDM.MonitoringDataConnection.GetConnection () [0x00000] in <filename unknown>:0 
  at MonitoringDM.Monitor.refreshSqlDs (MonitoringDM.MonitoringDataSource pDS) [0x00000] in <filename unknown>:0 
  at MonitoringDM.Monitor.refreshDataSource (System.Object state) [0x00000] in <filename unknown>:0 

Open in new window


Today I have installed on my Linux environment "IBM Data Server Client V10.1 for Linux X64" and tested it to ensure it is able to connect DB2 database from Linux.
During installation I had chosen "Full Install", so I assume it should include all drivers, hope .NET DbProvider for MONO should be installed also... but not sure.

Anyway, here MONO guys wrote that the "IBM.Data.DB2.dll" is part of MONO, and I have checked - I really can see that assembly installed in the GAC on MONO:
IBM.Data.DB2, Version=1.0.0.0, Culture=neutral, PublicKeyToken=7c307b91aa13d208

Open in new window


So, the question is - how to make it working?
How to make MONO on Linux able to find and use the "IBM.Data.DB2.dll" .NET DbProvider?
Or - is it possible to use (somehow) System.Data.OleDb .NET DbProvider to connect DB2 database from MONO on Linux?

Regards,
Dmitry.
0
Dmitry_Bond
Asked:
Dmitry_Bond
  • 9
  • 5
  • 2
3 Solutions
 
Tomas Helgi JohannssonCommented:
Hi!

Looking for mono-ibm-data-db2 + Centos on Google it came up with

http://pkgs.org/centos-6-rhel-6/epel-x86_64/ibm-data-db2-2.4.3.1-4.el6.x86_64.rpm.html

So there should be some additional Mono packages for DB2 for your Centos system that you could browse for on the repository. :)

Hope  this helps.

Regards,
   Tomas Helgi
0
 
Dmitry_BondAuthor Commented:
Seems it did not help, at all. :-(

First of all - it was installed old version of MONO as a package it depends on.
Second - it installed almost the same version of IBM.Data.Db2.dll but into /usr/lib64/mono, instead of /usr/local/lib/mono.

So, I see now 2 IBM.Data.Db2.dll files, both has version = 1.0.0.0, both has the same publicKey=7c307b91aa13d208, only size of file is a bit different.

Together with MONO 2.10.9 was  IBM.Data.Db2.dll, size=74752.
From EPEL repository it installed IBM.Data.Db2.dll, size=75776.

But anyway, it does not work - nor when run application with MONO 2.10.9, nor when run it with MONO 2.4.3.

So, it seems that package did not changed anything!

Do you have any other ideas?
0
 
Tomas Helgi JohannssonCommented:
Are your Centos 32 bit or 64 bit system ?
Make sure that you use correct packages (either 32 bit or 64 bit) as there are known incompatibilities between 32bit and 64 bit drives/systems.
I said (maybe not clearly enough,sorry about that ) that you would have to search for this package through either yum or apt-get which are connected to repositories that confirm to your Centos, Mono and DB2 versions.
Also make sure that the correct drivers are in required paths and lib directories (use link for that ). Look for that in manuals and readme's.


Regards,
   Tomas Helgi
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
Dmitry_BondAuthor Commented:
64bit.

I have searched for correct package in EPEL repository - there is only one such package actually.

But I just found information that it is impossible to connect DB2 from Linux using IBM.Data.Db2 assembly. Because IBM does not provide it for Linux at all. While MONO include some very old, non-maintainable version of this assembly.
So, it seems answer is - impossible to do using IBM.Data.Db2 assembly! :-(

However, I found a recommendation to use ODBC which may work. So, trying it now...
But getting a "Could not Construct a Property list error" error for DB2 ODBC driver I added. :-\ Do you know anything about it?
I see - there is a "Setup" parameter in odbcinst.ini file, but I cannot find any information what should be value of it for DB2?...
0
 
Tomas Helgi JohannssonCommented:
Hi!

Use the db2ca (DB2 Configuration Assistant) to configure the ODBC.

Regards,
    Tomas Helgi
0
 
Dmitry_BondAuthor Commented:
Seems db2ca is not exists on disk. However I did install all for "IBM DataServer Client Linux-x64 v10.1". So, I assume db2ca is not exists or name is wrong.
Unfortunately DB2 does not create any program groups in OS menu or shortcuts on OS desktop, so I have no idea - how also it could be called? Do you know?
0
 
Tomas Helgi JohannssonCommented:
Did the install setup a db2inst1 user ?
If so then it could be that everything is configured under that user and you have to make
sure that other users gain access to that as needed.
Check out that users environment variables if he exists.

Regards,
    Tomas Helgi
0
 
Dmitry_BondAuthor Commented:
Yes, of course it installed db2inst1 user.
But please explain - how exactly environment variables of db2inst1 user is related to the "db2ca (DB2 Configuration Assistant)" ?

For sure - there is nothing special in environment for that user (please see enclosed env.txt file).

PS. Btw, I have found db2ca but full name is db2ca.jar - that is a JAR file. So, Java-package. I cannot find - how to run it? I had tried to run a command "java db2ca.jar" but java reported that it does not know what to start there. Checked content of JAR - lot of java classes, manifest file does not point to the entry point class. So, I have no idea - how to run it. Do you know it?
Note: In my old scripts for Java I have found that need to set a CLASSPATH=db2ca.jar and then run command "java {className}" but I have no idea - what should be {classname} to start "DB2 Configuration Assistant"?... :-\
env.txt
0
 
Dmitry_BondAuthor Commented:
Ok... I have found a start command:

#!/bin/sh

# the $DB2_HOME is non-standard env.var - I added it by myself to point to place where Db2 installed
cd $DB2_HOME/tools

CLASSPATH=db2ca.jar:$CLASSPATH
export CLASSPATH

db2javit -j:com.ibm.db2.tools.ca.gui.ConfigurationAssistant 

Open in new window


Cataloged a DB2 database with option to register it as ODBC datasource. I see it in ODBCConfig tool but it is still failing to open it for editing in ODBCConfig tool with error = "Could not find setup property for ([...]/libdb2.so) in system information". Also error = "Could not construct a property list for ([...]/libdb2.so)".

However, tomorrow I'll check if I can connect to that ODBC datasource using my NET test application. Just for a case if that is only a bug of ODBCConfig tool but ODBC connection itself may work...
0
 
Tomas Helgi JohannssonCommented:
Hi!

There is a DB2 environment variables called
DB2_HOME and DB2INSTANCE :)
Those should be there and also if ODBC is configured correctly then other users should be able to use the ODBC connections.

http://pic.dhe.ibm.com/infocenter/db2luw/v9r7/index.jsp?topic=%2Fcom.ibm.db2.luw.apdv.cli.doc%2Fdoc%2Ft0006349.html

http://www.unixodbc.org/doc/db2.html

http://pic.dhe.ibm.com/infocenter/db2luw/v9r7/index.jsp?topic=%2Fcom.ibm.db2.luw.apdv.cli.doc%2Fdoc%2Ft0010406.html

http://www.easysoft.com/products/data_access/odbc-db2-driver/unixodbc.html

Regards,
    Tomas Helgi
0
 
Dmitry_BondAuthor Commented:
Some comments.

Just FYI: first 3 links you posted here do not describe things correctly. I mean - them do not make things working if make all according to description also - descriptions are not match current Linux OS approaches. Could be that descriptions are too old but DB2 libs and Linux OS are too new, so them do not match each other, while web-guys do not have time to update descriptions or write new ones.

Examples:
at least for last 5 years the unixODBC package is not manually installable. It is to be done from OS package manager.
Description of ODBC configuration missing any information of configuring "Setup" parameter - the GUI ODBC tool on Linux does not work without it.

Next, DB2_HOME env-variable is not defined by DB2! The Oracle defining ORACALE_HOME but DB2 does not define DB2_HOME. They use only $HOME env-var + "sqllib" symbol link in a home dir for user to access DB2.
0
 
mustaccioCommented:
Few things:
- DB2CA is deprecated as of DB2 10, so don't expect it to work
- neither .Net nor ODBC are supported by DB2 on Linux, only on Windows

The DB2 CLI driver (libdb2.so on Linux) implements the ODBC API, so if you point your existing ODBC driver manager to it as described in the first link above, it should in theory work.

DB2 does not implement the setup calls, so I think the Setup keyword should be omitted from the DB2 ODBC driver section (again, as shown in the link provided by TomasHelgi.

All other questions are not directly related to DB2, but rather to the ODBC driver manager, so I cannot comment on those.
0
 
Dmitry_BondAuthor Commented:
FYI - DB2CA is working fine on Linux. Need only know how to run it.

Then, some more DB2-related questions are:

1) Finally I was able to connect DB2 on Linux using ODBC connection string and IBM.Data.Db2.dll MONO assembly.
Do you think this way could be unreliable?

2) Do you know - why IBM is behaving in such strange way? Ignoring important connectivity questions for Linux? I mean - why they do not provide good connectivity possibilities?
0
 
mustaccioCommented:
> 1) Finally I was able to connect DB2 on Linux using ODBC connection string and
> IBM.Data.Db2.dll MONO assembly.
> Do you think this way could be unreliable?

It will be as (un)reliable as the developers of the IBM.Data.Db2.dll MONO assembly make it to be. It has nothing to do with DB2.

It is your choice to use unsupported software configurations.
0
 
Dmitry_BondAuthor Commented:
I did ask question about DB2 .NET/MONO connectivity for Linux on IBM forums.
Hope they will shed some light on it. Then I'll return to this question and see what to do with it.
0
 
Dmitry_BondAuthor Commented:
The reliable solution is still not found! :-(
By unknown reasons IBM is ignoring .NET support for Linux.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 9
  • 5
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now