3 The coordinator for the ADO.NET implementation is <a
4 href="mailto:rodrigo@ximian.com">Rodrigo Moya</a>, with
5 the collaboration of <a href="mailto:danmorg@sc.rr.com">Daniel
10 The current plan to implement ADO.NET is as follows:
12 <b>Step 1:</b> SqlClient:
15 * Implementation of System.Data.SqlClient based on
18 * Once the System.Data.SqlClient code is functional and
19 is usable by other people, we willl move it to
20 System.Data.PostgreSQL, and will convert the existing
21 System.Data.SqlClient to be just a wrapper around
22 System.Data.PostgreSQL.
28 * On Unix systems: System.Data.OleDb will use LibGDA as its
31 LibGDA is the data access engine that is used by
32 Gnome-Db (only libgda, not libgnomedb at all).
34 * On Windows systems: System.Data.OleDb will use OLE-DB as
38 <b>Step 3:</b> System.Data.SqlClient Providers:
41 * System.Data.SqlClient will then become a generic
42 proxy for binding to other SQL implementations other
43 than PostgreSQL (MySQL on Unix/Windows; MS SQL on
44 Window; Interbase on Unix/Windows). Others are welcomed.
47 <b>Step 4:</b> Other System.Data providers:
50 * The idea in MS .NET System.Data seems to be to have
51 a managed provider for each supported DBMS. So, apart
52 from System.Data.OleDb (generic) and System.Data.SqlClient,
53 we'll need to have System.Data.ODBC, System.Data.MySQL,
54 System.Data.Oracle, System.Data.PostgreSQL, etc. Others,
55 of course, are welcomed.
60 We are able now to run basic commands (INSERT, DELETE) into a
61 PostgreSQL database (see mcs/class/System.Data/Test/TestSqlInsert.cs).
62 To compile that test program, you need:
67 * update your mono sources.
69 * get the .dll's and mcs.exe built on windows, and put them on your
72 * compile the test program along with the System.Data.Common and
73 System.Data.SqlClient files.
78 In order to test System.Data.SqlClient, you will need to have
79 access to a remote PostgreSQL DBMS, or you will have to install
80 one locally. PostgreSQL is the DBMS used for the initial
81 implementation of System.Data.SqlClient.
83 Why? Because it is open source, has a client
84 library that is easy to use, PostgreSQL is easy to install
85 using the Cygwin install program, not difficult to setup after
86 installation, and it runs under: Linux,
87 Windows (via cygwin and ipc-daemon), Unix, and
88 others. This allowed us to create the
89 System.Data functionality in Mono much quicker.
91 If you plan on using a remote PostgreSQL DBMS Server,
92 than you will need to have the PostgreSQL client software on your
93 local computer that includes libpq.so (pq.dll on Windows).
95 Installation instructions for PostgreSQL DBMS:
102 * It easier to install PostgreSQL on Linux than Windows.
108 * Use the cygwin installer to install the PostgreSQL DBMS. It is
109 found in the database category.
111 * Read the file postgres-x.x.README at /usr/doc/Cygwin and read
112 the requirements to install PostgreSQL. Those requirements
113 are included with cygwin except cygipc. A default installtion
114 of cygwin does not install everything you will need, so on the
115 safe side, just include everything when installing cygwin.
117 The -x.x in postgres-x.x is the version of your PostgreSQL DBMS.
119 * Once cygwin has installed PostgreSQL on your computer,
120 read the file FAQ_MSWIN which is available
121 in /usr/doc/postgres-x.x\FAQ_MSWIN
123 The -x.x in postgres-x.x is the version of your PostgreSQL DBMS.
125 Important notes from this file are:
127 * Point 2. - Install the latest cygipc package,
129 http://www.neuro.gatech.edu/users/cwilson/cygutils/V1.1/cygipc/
131 The cygipc package contains the ipc-daemon you will need
132 to run before you can
133 run the PostgreSQL DBMS Server daemon (postmaster) or run
134 initdb which initializes the PostgreSQL database.
136 * Point 3. The Cygwin bin directory has to be placed in
137 the path before the Windows program directories,
138 for example, C:\cygwin\bin
140 My own note, in the Windows control panel, I set
141 the environment variables PATH to my cygwin /usr/local/bin,
142 /usr/bin, and /bin. I also set my LD_LIBRARY_PATH to
143 /usr/local/lib and /usr/lib. For example:
145 PATH=c:\cygwin\usr\local\bin;c:\cygwin\usr\bin;c:\cygwin\bin;
146 LD_LIBRARY_PATH=c:\cygwin\usr\local\lib;c:\cygwin\usr\lib;
148 * Point 4. Start the ipc-daemon that came with the cygipc package. There
149 are two ways to do this: run it from the command line as:
152 or you can set it up as a Windows service. See the
153 file cygrunsrv.README at /usr/doc/Cygwin on how to do this
154 for ipc-daemon and postmaster. Note the
155 troubleshooting section at the end of
156 the cygrunsrv.README file.
158 To install ipc-daemon as a service,
159 you just have to run 'ipc-daemon --install-as-service' (--remove-as-service)
160 and then run 'net start ipc-daemon'
162 * Read the installation.html file
163 at /usr/doc/postgresql-x.x/html/installation.html
165 In this file, you will run the following commands:
167 * mkdir /usr/local/pgsql/data
\r
168 * initdb -D /usr/local/pgsql/data
\r
169 * postmaster -D /usr/local/pgsql/data >logfile 2>&1 &
\r
173 When you need to connect to the database,
174 you will need ipc-daemon and postmaster running. Start ipc-daemon
175 before any of the command above.
177 psql is a command-line PostgreSQL client tool to
178 enter and run SQL commands and queries.
180 If there is no database user named postgres, create a user named
181 postgres with the following SQL command in the client tool psql:
183 create user postgres with password 'fun2db';
184 The only reason I say this is so you can easily use the System.Data tests
185 without having to change the database, userid, etc.
189 In the path mcs/class/System.Data/Test
190 there is a PostgreSQL test program named
191 PostgreTest.cs. Thanks goes to Gonzalo for creating the original
193 To use it to test System.Data, you
194 modify the file to your PostgreSQL database
195 connection requirements:
197 dbname is the database, ie, test
198 host is the hostname of the PostgreSQL DBMS Server to connect to
199 user is the username, ie, someuser
200 password is the password, ie, mypass1234
202 The connection string is in OLE-DB connection string format. Internally,
203 SqlConnection converts this to the PostgreSQL connection string format.
205 OLE-DB: "host=localhost;dbname=test;user=joe;password=smoe"
206 PostgreSQL: "host=localhost dbname=test user=joe password=smoe"
208 Note that OLE-DB includes the semicolons while PostgreSQL's connection
211 To compile the PostgresTest.cs program, do:
212 mcs PostgresTest.cs -r System.Data
214 To run using mint, do:
215 mint PostgresTest.exe
217 To run using mono, do:
218 mono PostgresTest.exe
220 You should get something like:
222 Administrator@DANPC ~/mono/mcs/class/System.Data/Test
\r
223 $ mcs PostgresTest.cs -r System.Data
\r
225 Administrator@DANPC ~/mono/mcs/class/System.Data/Test
\r
226 $ mint PostgresTest.exe
\r
227 Postgres provider specific tests...
\r
230 Error (don't worry about this one)
\r
231 Create table with all supported types:
\r
233 Insert values for all known types:
\r
235 Select values from the database:
\r
237 dt.Columns.Count: 6
\r
238 * Column Name: int2_value
\r
241 * Column Name: int4_value
\r
244 * Column Name: bigint_value
\r
247 * Column Name: char_value
\r
249 Type: System.String
\r
250 * Column Name: varchar_value
\r
252 Type: System.String
\r
253 * Column Name: text_value
\r
255 Type: System.String
\r
257 Col 0: int2_value - -22
\r
258 Col 1: int4_value - 1048000
\r
259 Col 2: bigint_value - 123456789012345
\r
260 Col 3: char_value - This is a char
\r
261 Col 4: varchar_value - This is a varchar
\r
262 Col 5: text_value - This is a text
\r