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 <p>We are able to do simple CREATE TABLE, DROP TABLE, INSERT, and
61 DELETE SQL commands using the ExecuteNonQuery method in SqlCommand.
63 <p>We are also able to do simple aggregate functions,
64 ie, count(), sum(), avg(), min(), and
65 max() in a simple SELECT SQL query using ExecuteSecalar() now.
67 <p>We are also able to retrieve data with a simple SELECT SQL query
68 using ExecuteReader() which returns a SqlDataReader. We are able to
69 GetSchemaTable() get the meta data about the table columns. We are able
70 to Read() to get each row from the result set. We are able to get
71 String data (char, bpchar (character), text, varchar), Int16 (int2 or smallint),
72 and Int32 (int4 or integer), Int64 (int8 or bigint). More data types will
75 <p>Parameters are not working nor has stored procedures been tested - but they will be.
77 <p>A lot of functionality in System.Data is missing, but the infrastructure is
78 starting to come together.
80 <p>To compile that test program, you need:
85 * update your mono sources.
87 * get the .dll's and mcs.exe built on windows, and put them on your
90 * compile the test program along with the System.Data.Common and
91 System.Data.SqlClient files.
96 <p>In order to test System.Data.SqlClient, you will need to have
97 access to a remote PostgreSQL DBMS, or you will have to install
98 one locally. PostgreSQL is the DBMS used for the initial
99 implementation of System.Data.SqlClient.
101 <p>Why? Because it is open source, has a client
102 library that is easy to use, PostgreSQL is easy to install
103 using the Cygwin install program, not difficult to setup after
104 installation, and it runs under: Linux,
105 Windows (via cygwin and ipc-daemon), Unix, and
106 others. This allowed us to create the
107 System.Data functionality in Mono much quicker.
109 <p>If you plan on using a remote PostgreSQL DBMS Server,
110 than you will need to have the PostgreSQL client software on your
111 local computer that includes libpq.so (pq.dll on Windows).
113 <p>Installation instructions for PostgreSQL DBMS:
120 * It easier to install PostgreSQL on Linux than Windows.
126 * Use the cygwin installer to install the PostgreSQL DBMS. It is
127 found in the database category.
129 * <p>Read the file postgres-x.x.README at /usr/doc/Cygwin and read
130 the requirements to install PostgreSQL. Those requirements
131 are included with cygwin except cygipc. A default installtion
132 of cygwin does not install everything you will need, so on the
133 safe side, just include everything when installing cygwin.
135 <p>The -x.x in postgres-x.x is the version of your PostgreSQL DBMS.
137 * <p>Once cygwin has installed PostgreSQL on your computer,
138 read the file FAQ_MSWIN which is available
139 in /usr/doc/postgres-x.x\FAQ_MSWIN
141 <p>The -x.x in postgres-x.x is the version of your PostgreSQL DBMS.
143 <p>Important notes from this file are:
146 * <p>Point 2. - Install the latest cygipc package,
148 http://www.neuro.gatech.edu/users/cwilson/cygutils/V1.1/cygipc/
150 The cygipc package contains the ipc-daemon you will need
151 to run before you can
152 run the PostgreSQL DBMS Server daemon (postmaster) or run
153 initdb which initializes the PostgreSQL database.
155 * <p>Point 3. The Cygwin bin directory has to be placed in
156 the path before the Windows program directories,
157 for example, C:\cygwin\bin
159 My own note, in the Windows control panel, I set
160 the environment variables PATH to my cygwin /usr/local/bin,
161 /usr/bin, and /bin. I also set my LD_LIBRARY_PATH to
162 /usr/local/lib and /usr/lib. For example:
165 PATH=c:\cygwin\usr\local\bin;c:\cygwin\usr\bin;c:\cygwin\bin;
166 LD_LIBRARY_PATH=c:\cygwin\usr\local\lib;c:\cygwin\usr\lib;
170 * <p>Point 4. Start the ipc-daemon that came with the cygipc package. There
171 are two ways to do this: run it from the command line as:
178 <p>or you can set it up as a Windows service. See the
179 file cygrunsrv.README at /usr/doc/Cygwin on how to do this
180 for ipc-daemon and postmaster. Note the
181 troubleshooting section at the end of
182 the cygrunsrv.README file.
184 <p>To install ipc-daemon as a service,
189 ipc-daemon --install-as-service' (--remove-as-service)
200 * <p>Read the installation.html file
201 at /usr/doc/postgresql-x.x/html/installation.html
203 <p>In this file, you will run the following commands:
206 mkdir /usr/local/pgsql/data
\r
207 initdb -D /usr/local/pgsql/data
\r
208 postmaster -D /usr/local/pgsql/data >logfile 2>&1 &
\r
213 <p>When you need to connect to the database,
214 you will need ipc-daemon and postmaster running. Start ipc-daemon
215 before any of the command above.
217 <p>psql is a command-line PostgreSQL client tool to
218 enter and run SQL commands and queries.
220 <p>If there is no database user named postgres, create a user named
221 postgres with the following SQL command in the client tool psql:
226 create user postgres with password 'fun2db';
229 <p>The only reason I say this is so you can easily use the System.Data tests
230 without having to change the database, userid, etc.
233 <p>In the path mcs/class/System.Data/Test
234 there is a PostgreSQL test program named
235 PostgreTest.cs. Thanks goes to Gonzalo for creating the original
238 <p>To use it to test System.Data, you
239 modify the file to your PostgreSQL database
240 connection requirements:
244 dbname is the database, ie, test
245 host is the hostname of the PostgreSQL DBMS Server to connect to
246 user is the username, ie, someuser
247 password is the password, ie, mypass1234
250 <p>The connection string is in OLE-DB connection string format. Internally,
251 SqlConnection converts this to the PostgreSQL connection string format.
255 OLE-DB: "host=localhost;dbname=test;user=joe;password=smoe"
256 PostgreSQL: "host=localhost dbname=test user=joe password=smoe"
260 Note that OLE-DB includes the semicolons while PostgreSQL's connection
264 To compile the PostgresTest.cs program, do:
268 mcs PostgresTest.cs -r System.Data
272 To run using mint, do:
276 mint PostgresTest.exe
280 To run using mono, do:
282 mono PostgresTest.exe
285 <p>You should get something like:
289 Administrator@DANPC ~/mono/mcs/class/System.Data/Test
\r
290 $ mcs PostgresTest.cs -r System.Data
\r
292 Administrator@DANPC ~/mono/mcs/class/System.Data/Test
\r
293 $ mint PostgresTest.exe
\r
294 Postgres provider specific tests...
\r
297 Error (don't worry about this one)
\r
298 Create table with all supported types:
\r
300 Insert values for all known types:
\r
302 Select values from the database:
\r
304 dt.Columns.Count: 6
\r
305 * Column Name: int2_value
\r
308 * Column Name: int4_value
\r
311 * Column Name: bigint_value
\r
314 * Column Name: char_value
\r
316 Type: System.String
\r
317 * Column Name: varchar_value
\r
319 Type: System.String
\r
320 * Column Name: text_value
\r
322 Type: System.String
\r
324 Col 0: int2_value - -22
\r
325 Col 1: int4_value - 1048000
\r
326 Col 2: bigint_value - 123456789012345
\r
327 Col 3: char_value - This is a char
\r
328 Col 4: varchar_value - This is a varchar
\r
329 Col 5: text_value - This is a text
\r