Welcome to mirror list, hosted at ThFree Co, Russian Federation.

ibmdb2 « web - github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 3f148232652e5cb1f3b4f7cadf24a4341471fbd4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
* IBM DB2 Data Provider
<ul>
	<li>ADO.NET Data Provider for <a href="http://www-3.ibm.com/software/data/db2/">IBM DB2 Universal Database</a></li>

	<li>Exists in namespace DB2ClientCS and assembly Mono.Data.DB2Client</li>
	
	<li>The source code exists at mcs/class/Mono.Data.DB2Client</li>
			
	<li>Requires the Call Level Interface to IBM DB2 shared library.  This
	is db2cli.dll on Windows.  The IBM DB2 CLI API is very similar to the ODBC API. If
	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
	DllImport's have similiar function names.</li>
			
	<li>IBM DB2 Provider created by Christopher Bockner.</li>
	
	<li>Bugs with Mono or the data provider should be reported 
	in Mono's Bugzilla <a href="http://bugzilla.ximian.com/">here</a>.  If you
	do not have Bugzilla user account, it is free 
	and easy to 
	create one <a href="http://bugzilla.ximian.com/createaccount.cgi">here</a>.</li>
	
</ul>
	
** Current Status

<ul>
	<li>Compiles on Windows and Linux.  Works on Windows.  Still needs to be tested on Linux.</li>
	
	<li>Able to connect to IBM DB2</li>
	
	<li>Able to execute DML, such as, CREATE TABLE via ExecuteNonQuery()</li>
	
	<li>Christopher says it can retrieve data via the DB2ClientDataReader</li>
	   
</ul>
	
** Action Plan

<ul>
		<li>Still needs work to get it to retrieve data via ExecuteReader() and
	use the data reader to read data.</li>

</ul>

** Testing

In order to test.
<ul>
	<li>Have working mono and mcs setup</li>
	
	<li>Have access to an IBM DB2 database.  If you do not have access, download the
	<a href="http://www-3.ibm.com/software/data/db2/">IBM DB2</a> software.  There 
	are versions for Windows, Linux, AIX, and Sun Solaris.</li>
	
	<li>Make sure the assembly Mono.Data.DB2Client.dll was built and installed 
	where the other class libraries are installed.</li>
	
	<li>If you do not have the source to mcs, get the source from
	<a href="http://www.go-mono.com/download">here</a></li>
	
	<li>Has a ConnectionString format like ODBC</li>
	
	<li>Here is a ConnectionString format if you have a DSN setup: 
<pre>
 "DSN=dataSetName;UID=myuserid;PWD=mypassword"
</pre>
	</li>

	<li>Here is a ConnectionString format if you do not have a DSN (have not
	gotten this to work though, so, I am open to suggestions):
<pre>
 "DRIVER={DB2 Driver};SERVER=localhost;DATABASE=test;UID=myuserid;PASSWORD=mypassword"
</pre>
	</li>
	
	<li>In mcs/class/Mono.Data.DB2Client/Test/DBConnTest, you will find
	a DBConnTest.cs.</li> 
	
	<li>To build DBConnTest:
		<ul>
			<li>On Unix:</li>
<pre>
mcs DBConnTest.cs -r System.Data.dll -r Mono.Data.DB2Client.dll
</pre>
			</li>
			<li>On Windows via Cygwin:
<pre>
mono C:/cygwin/home/MyHome/mono/install/bin/mcs.exe DBConnTest.cs \ 
     -lib:C:/cygwin/home/MyHome/mono/install/lib \
     -r System.Data.dll -r Mono.Data.DB2Client.dll
</pre>
			</li>
			<li>To run it on mono:
<pre>
mono DBConnTest.exe database userid password
</pre>
			</li>
		</ul>
		</li>
		
	<li>C# Example:
<pre>
 using System;
 using System.Data;
 using Mono.Data.DB2Client;
 
 public class Test 
 {
    public static void Main(string[] args)
    {
       string connectionString = 
          "DSN=sample;UID=db2admin;PWD=mypass";
       IDbConnection dbcon = new DB2ClientConnection(connectionString);
       dbcon.Open();
       IDbCommand dbcmd = dbcon.CreateCommand();
       string sql =
            "CREATE TABLE mono_db2_test1 ( " +
            "   testid varchar(2), " +
            "   testdesc varchar(16) " +
            ")";
       dbcmd.CommandText = sql;
       dbcmd.ExecuteNonQuery();
       dbcmd.Dispose();
       dbcmd = null;
       dbcon.Close();
       dbcon = null;
    }
 }
</pre>
	</li>
	<li>Building C# Example:
	<ul>
		<li>Save the example to a file, such as, TestExample.cs</li>
		<li>Build on Linux:
<pre>
	mcs TestExample.cs -r System.Data.dll \
	    -r Mono.Data.DB2Client.dll
</pre>
		</li>
		<li>Build on Windows via Cygwin:
<pre>
	mono C:/cygwin/home/MyHome/mono/install/bin/mcs.exe \
	     TestExample.cs \
	     -lib:C:/cygwin/home/MyHome/mono/install/lib \
	     -r System.Data.dll -r Mono.Data.DB2Client.dll
</pre>
		</li>
	</ul>
	</li>
	<li>Running the Example:
<pre>
mono TestExample.exe
</pre>
	</li>
		
</ul>