Fix ContributorComparer.
[mono.git] / doc / ibmdb2
1 * IBM DB2 Data Provider
2 <ul>
3         <li>ADO.NET Data Provider for <a href="http://www-3.ibm.com/software/data/db2/">IBM DB2 Universal Database</a></li>
4
5         <li>Exists in namespace DB2ClientCS and assembly Mono.Data.DB2Client</li>
6         
7         <li>The source code exists at mcs/class/Mono.Data.DB2Client</li>
8                         
9         <li>Requires the Call Level Interface to IBM DB2 shared library.  This
10         is db2cli.dll on Windows.  The IBM DB2 CLI API is very similar to the ODBC API. If
11         you take a look at Mono's <a href="http://www.go-mono.com/odbc.html">System.Data.Odbc</a> ODBC provider, you will see the
12         DllImport's have similiar function names.</li>
13                         
14         <li>IBM DB2 Provider created by Christopher Bockner.</li>
15         
16         <li>Bugs with Mono or the data provider should be reported 
17         in Mono's Bugzilla <a href="http://bugzilla.ximian.com/">here</a>.  If you
18         do not have Bugzilla user account, it is free 
19         and easy to 
20         create one <a href="http://bugzilla.ximian.com/createaccount.cgi">here</a>.</li>
21         
22 </ul>
23         
24 ** Current Status
25
26 <ul>
27         <li>Compiles on Windows and Linux.  Works on Windows.  Still needs to be tested on Linux.</li>
28         
29         <li>Able to connect to IBM DB2</li>
30         
31         <li>Able to execute DML, such as, CREATE TABLE via ExecuteNonQuery()</li>
32         
33         <li>Christopher says it can retrieve data via the DB2ClientDataReader</li>
34            
35 </ul>
36         
37 ** Action Plan
38
39 <ul>
40                 <li>Still needs work to get it to retrieve data via ExecuteReader() and
41         use the data reader to read data.</li>
42
43 </ul>
44
45 ** Testing
46
47 In order to test.
48 <ul>
49         <li>Have working mono and mcs setup</li>
50         
51         <li>Have access to an IBM DB2 database.  If you do not have access, download the
52         <a href="http://www-3.ibm.com/software/data/db2/">IBM DB2</a> software.  There 
53         are versions for Windows, Linux, AIX, and Sun Solaris.</li>
54         
55         <li>Make sure the assembly Mono.Data.DB2Client.dll was built and installed 
56         where the other class libraries are installed.</li>
57         
58         <li>If you do not have the source to mcs, get the source from
59         <a href="http://www.go-mono.com/download">here</a></li>
60         
61         <li>Has a ConnectionString format like ODBC</li>
62         
63         <li>Here is a ConnectionString format if you have a DSN setup: 
64 <pre>
65  "DSN=dataSetName;UID=myuserid;PWD=mypassword"
66 </pre>
67         </li>
68
69         <li>Here is a ConnectionString format if you do not have a DSN (have not
70         gotten this to work though, so, I am open to suggestions):
71 <pre>
72  "DRIVER={DB2 Driver};SERVER=localhost;DATABASE=test;UID=myuserid;PASSWORD=mypassword"
73 </pre>
74         </li>
75         
76         <li>In mcs/class/Mono.Data.DB2Client/Test/DBConnTest, you will find
77         a DBConnTest.cs.</li> 
78         
79         <li>To build DBConnTest:
80                 <ul>
81                         <li>On Unix:</li>
82 <pre>
83 mcs DBConnTest.cs -r System.Data.dll -r Mono.Data.DB2Client.dll
84 </pre>
85                         </li>
86                         <li>On Windows via Cygwin:
87 <pre>
88 mono C:/cygwin/home/MyHome/mono/install/bin/mcs.exe DBConnTest.cs \ 
89      -lib:C:/cygwin/home/MyHome/mono/install/lib \
90      -r System.Data.dll -r Mono.Data.DB2Client.dll
91 </pre>
92                         </li>
93                         <li>To run it on mono:
94 <pre>
95 mono DBConnTest.exe database userid password
96 </pre>
97                         </li>
98                 </ul>
99                 </li>
100                 
101         <li>C# Example:
102 <pre>
103  using System;
104  using System.Data;
105  using Mono.Data.DB2Client;
106  
107  public class Test 
108  {
109     public static void Main(string[] args)
110     {
111        string connectionString = 
112           "DSN=sample;UID=db2admin;PWD=mypass";
113        IDbConnection dbcon = new DB2ClientConnection(connectionString);
114        dbcon.Open();
115        IDbCommand dbcmd = dbcon.CreateCommand();
116        string sql =
117             "CREATE TABLE mono_db2_test1 ( " +\r
118             "   testid varchar(2), " +\r
119             "   testdesc varchar(16) " +\r
120             ")";
121        dbcmd.CommandText = sql;
122        dbcmd.ExecuteNonQuery();
123        dbcmd.Dispose();
124        dbcmd = null;
125        dbcon.Close();
126        dbcon = null;
127     }
128  }
129 </pre>
130         </li>
131         <li>Building C# Example:
132         <ul>
133                 <li>Save the example to a file, such as, TestExample.cs</li>
134                 <li>Build on Linux:
135 <pre>
136         mcs TestExample.cs -r System.Data.dll \
137             -r Mono.Data.DB2Client.dll
138 </pre>
139                 </li>
140                 <li>Build on Windows via Cygwin:
141 <pre>
142         mono C:/cygwin/home/MyHome/mono/install/bin/mcs.exe \
143              TestExample.cs \
144              -lib:C:/cygwin/home/MyHome/mono/install/lib \
145              -r System.Data.dll -r Mono.Data.DB2Client.dll
146 </pre>
147                 </li>
148         </ul>
149         </li>
150         <li>Running the Example:
151 <pre>
152 mono TestExample.exe
153 </pre>
154         </li>
155                 
156 </ul>
157