1 * IBM DB2 Data Provider
3 <li>Exists in namespace DB2ClientCS and assembly Mono.Data.DB2Client</li>
5 <li>The source code exists at mcs/class/Mono.Data.DB2Client</li>
7 <li>Requires the Call Level Interface to IBM DB2 shared library. This
8 is db2cli.dll on Windows. The IBM DB2 CLI API is very similar to the ODBC API. If
9 you take a look at Mono's System.Data.Odbc ODBC provider, you will see the
10 DllImport's have similiar function names.</li>
12 <li><a href="http://www-3.ibm.com/software/data/db2/">IBM DB2 Universal Database</a> can be downloaded from IBM.</li>
14 <li>IBM DB2 Provider created by Christopher Bockner.</li>
20 <li>Compiles on Windows and Linux. Works on Windows. Still needs to be tested on Linux.</li>
22 <li>Able to connect to IBM DB2</li>
24 <li>Able to execute DML, such as, CREATE TABLE via ExecuteNonQuery()</li>
31 <li>Still needs work to get it to retrieve data via ExecuteReader() and
32 use the data reader to read data.</li>
40 <li>Have working mono and mcs setup</li>
42 <li>Have access to an IBM DB2 database. If you do not have access, download the
43 <a href="http://www-3.ibm.com/software/data/db2/">IBM DB2</a> software. There
44 are versions for Windows, Linux, AIX, and Sun Solaris.</li>
46 <li>Make sure the assembly Mono.Data.DB2Client.dll was built and installed
47 where the other class libraries are installed.</li>
49 <li>If you do not have the source to mcs, get the source from
50 <a href="http://www.go-mono.com/download">here</a></li>
52 <li>In mcs/class/Mono.Data.DB2Client/Test/DBConnTest, you will find
55 <li>To build DBConnTest:
59 mcs DBConnTest.cs -r System.Data.dll -r Mono.Data.DB2Client.dll
62 <li>On Windows via Cygwin:
64 mono C:/cygwin/home/MyHome/mono/install/bin/mcs.exe DBConnTest.cs \
65 -lib:C:/cygwin/home/MyHome/mono/install/lib \
66 -r System.Data.dll -r Mono.Data.DB2Client.dll
69 <li>To run it on mono:
71 mono DBConnTest.exe database userid password
81 using Mono.Data.DB2Client;
85 public static void Main(string[] args)
87 string connectionString =
88 "DSN=sample;UID=db2admin;PWD=mypass";
89 IDbConnection dbcon = new DB2ClientConnection(connectionString);
90 IDbCommand dbcmd = dbcon.CreateCommand();
92 "CREATE TABLE mono_db2_test1 ( " +
\r
93 " testid varchar(2), " +
\r
94 " testdesc varchar(16) " +
\r
96 dbcmd.CommandText = sql;
97 dbcmd.ExecuteNonQuery();
106 <li>Building C# Example:
108 <li>Save the example to a file, such as, TestExample.cs</li>
111 mcs TestExample.cs -r System.Data.dll \
112 -r Mono.Data.DB2Client.dll
115 <li>Build on Windows via Cygwin:
117 mono C:/cygwin/home/MyHome/mono/install/bin/mcs.exe \
119 -lib:C:/cygwin/home/MyHome/mono/install/lib \
120 -r System.Data.dll -r Mono.Data.DB2Client.dll
125 <li>Running the Example: