br
[mono.git] / web / ado-net
1 * ADO.NET
2
3 <p>Mono's ADO.NET Developers:
4
5 <table border=1>
6
7 <tr>
8         <td><b>Developer</b></td>
9         <td><b>Email</b></td>
10         <td><b>Contribution</b></td>
11 </tr>
12
13 <tr>
14         <td>Rodrigo Moya</td>
15         <td>rodrigo -AT-<br> ximian.comNOSPAM</td>
16         <td>ADO.NET coordinator,<br> OLE DB provider,<br> and tests</td>
17 </tr>
18
19 <tr>
20         <td>Daniel Morgan</td>
21     <td>danmorg -AT-<br> sc.rr.comNOSPAM</td>
22     <td>MySQL, PostgreSQL, <br>Oracle providers,<br> and tests</td>
23 </tr>
24
25 <tr>
26         <td>Tim Coleman</td>
27         <td>tim -AT- <br>timcoleman.comNOSPAM</td>
28         <td>Microsoft SQL Server, <br>Sybase, <br>TDS providers,<br> Oracle, 
29                 <br>and tests.<br>
30                 He has
31             contributed <br>to other parts <br>of Mono too, <br>such as, 
32             <br>EnterpriseServices,
33             XML, <br>and WebServices.</td>
34 </tr>
35
36 <tr>
37         <td>Brian Ritchie</td>
38         <td>brianlritchie -AT-<br> hotmail.comNOSPAM</td>
39         <td>ODBC provider <br>and the ProviderFactory <br>in Mono.Data</td>
40 </tr>
41
42 <tr>
43         <td>Vladimir Vukicevic</td> 
44         <td>vladimir -AT-<br> pobox.comNOSPAM</td>
45         <td>SQL Lite provider. <br> He has contributed to GTK# <br>and mPhoto too.</td>
46 </tr>
47
48 <tr>
49         <td>Christopher Bockner</td>
50         <td>cleared -AT-<br> rogers.comNOSPAM</td>
51         <td>IBM DB2 Universal <br>Database provider</td>
52 </tr>
53
54 <tr>
55         <td>Ville Palo</td>
56         <td>vi64pa -AT-<br> koti.soon.fiNOSPAM</td>
57         <td>XML stuff <br>in System.Data <br>including DataSet <br>
58            and XmlDataDocument, <br>and tests</td>
59 </tr>
60
61 <tr>
62         <td>Gonzalo Paniagua Javier</td>
63         <td>gonzalo -AT-<br> ximian.comNOSPAM</td>
64         <td>Integration between <br>System.Web and <br>System.Data</td>
65 </tr>
66
67 <tr>
68         <td>Gaurav Vaish</td>
69         <td>gvaish -AT-<br> iitk.ac.inNOSPAM</td>
70         <td>Web controls</td>
71 </tr>
72
73 <tr>
74         <td>Phillip Jerkins</td>
75         <td>Phillip.Jerkins -AT-<br> morgankeegan.comNOSPAM</td>
76         <td>Named Instance support <br>in System.Data.SqlClient</td>
77 </tr>
78
79 </table>
80
81 ** Bugs and Feature Requests
82
83 <ul>
84
85         <li>Bugs with Mono or any data provider in Mono should be reported 
86             in Mono's Bugzilla <a href="http://bugzilla.ximian.com/">here</a>.  If you
87             do not have a Bugzilla user account, it is free 
88             and easy to create 
89             one <a href="http://bugzilla.ximian.com/createaccount.cgi">here</a>.</li>
90         
91         <li>Any RFE (Request For Enhancement) for features missing or new functionality
92             should be entered as a bug in Bugzilla too</li>
93
94 </ul>
95         
96 ** ADO.NET Data Providers
97         
98 <p>List of ADO.NET Data Providers working in Mono:
99                         
100 <ul>
101         <li><a href="http://www.go-mono.com/ibmdb2.html">IBM DB2 Universal Database</a></li>
102         <li><a href="http://www.go-mono.com/mysql.html">MySQL</a></li>
103         <li><a href="http://www.go-mono.com/odbc.html">ODBC</a></li>
104         <li><a href="http://www.go-mono.com/oracle.html">Oracle</a></li>
105         <li><a href="http://www.go-mono.com/oledb.html">OLE DB</a></li>
106         <li><a href="http://www.go-mono.com/postgresql.html">PostgreSQL</a></li>
107         <li><a href="http://www.go-mono.com/sqlclient.html">Microsoft SQL Server</a></li>
108         <li><a href="http://www.go-mono.com/sqlite.html">SQL Lite</a></li>
109         <li><a href="http://www.go-mono.com/sybase.html">Sybase</a></li>
110         <li><a href="http://www.go-mono.com/tdsclient.html">TDS Generic</a></li>
111 </ul>
112
113 <p>Providers which we do not have, but we would like to have.  Currently,
114         some of these databases are supported via the ODBC or OLE DB providers.
115
116 <ul>
117         <li><a href="http://msdn.microsoft.com/library/en-us/dnsql2k/html/sqlxml_intromanagedclasses.asp?frame=true">Managed Classes for SqlXml</a> which is
118                 a .NET data provider for retrieving XML data from a Microsoft SQL Server 2000 database.  The System.Data.SqlClient provider
119                 in Mono can be used as a starting point at mcs/class/System.Data/System.Data.SqlClient.</li>
120         <li><a href="http://www.hughes.com.au/">miniSQL</a></li>
121         <li><a href="http://www.sleepycat.com/">BerkeleyDB (Sleepycat)</a></li>
122         <li><a href="http://www.sapdb.org/">SapDB</a></li>
123         <li><a href="http://www-3.ibm.com/software/data/informix/">Informix</a></li>    
124         <li><a href="http://msdn.microsoft.com/vfoxpro/">Foxpro</a></li>        
125         <li>Microsoft Access - could be done by creating C# bindings to <a href="http://mdbtools.sourceforge.net">MDB Tools</a></li>
126         <li>dbase or xbase type database files</li>
127         <li>Others are welcome</li>
128 </ul>
129
130 <p>External Projects that have created ADO.NET Providers that work on Mono:
131
132 <ul>
133
134         <li><a href="http://www.go-mono.com/firebird.html">Firebird Interbase</a></li> is a
135            Firebird SQL Managed data provider. It can be used with Interbase databases too.  It
136            is written in 100%C# and does not require a client library. Works on .NET and Mono.</a>
137         <li><a href="http://gborg.postgresql.org/project/npgsql/projdisplay.php">Npgsql</a> is a 
138            PostgreSQL Managed data provider written 
139            in 100% C#, does not require a client library, and works on .NET and Mono</li>
140         <li><a href="http://sourceforge.net/projects/mysqlnet/">MySQLNet</a> is a 
141            MySQL Managed data provider written in 100% C#, does not
142            require a client library, and works on .NET and Mono</li>
143 </ul>
144
145 ** Tools
146
147 <p>Some tools that can be used for ADO.NET and other technologies (ASP.NET, XML, etc).
148
149 <ul>    
150                 <li><b>SQL# CLI</b> - a SQL query tool with a command-line interface.
151                     It can be used to enter and execute SQL statements or 
152                     execute a batch of SQL commands from a file.   It can
153                   be used to test connection strings, connect to various ADO.NET
154                   providers, save output to text, html, or xml.  It is a work-in-progress.
155                   The SQL# CLI is distributed with the
156                   Mono runtime and class libraries as an executable assembly sqlsharp.exe.
157                   The source to SQL# CLI can be found in the mcs source at
158                   mcs/tools/SqlSharp/SqlSharpCli.cs
159                   </li>
160                   
161                 <li><p><b>SQL# GUI - a graphical SQL query tool</b> allows a user
162                   to enter SQL commands in a top panel which is a text editor.  It
163                   has a toolbar and menu for various tasks, such as, executing
164                   SQL commands one-at-a-time or in a batch.  The results would appear
165                   in a bottom panel in a grid or could be saved to a file (xml, html, csv).
166                   Also, the bottom panel would allow logging of SQL command executed.
167                   Currently, there is a <a href="http://go-mono.com/images/sqlsharp.png">SQL# For GTK#</a> which
168                   provides a GUI interface using the <a href="http://gtk-sharp.sourceforge.net">Gtk#</a> toolkit.  SQL# For GTK#
169                   is a work-in-progress and can be found in the mcs source at 
170                   mcs/tools/SqlSharp/gui/gtk-sharp</li>  
171 </ul>
172
173 <p>Tools we would like to have, but they have not been created yet:
174
175 <ul>
176                 <li><b>XML Schema Definition tool</b> <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cptools/html/cpconxmlschemadefinitiontoolxsdexe.asp">xsd.exe</a> needs 
177                         to be created.  Maybe this TODO item should be at the System.XML web page instead.
178                         
179                         <ul>
180                                 <li>This tool
181                                         would work like the xsd.exe tool included with 
182                                         the .NET Framework.  The Xsd.exe tools has the\r
183                                         following uses:\r
184                                         <ul>\r
185                                         <li><b>XDR to XSD</b> - used to generate an XML schema from an XDR (XML Data Reduced schema) file. \r
186                                                 XDR was used by Microsoft prior to XSD becoming a W3C recommendation.  So, this needs\r
187                                                 to be supported for legacy reasons</li>\r
188                                         <li><b>XML to XSD</b> - used to generate an XML schema from an XML file</li> \r
189                                         <li><b>XSD to DataSet</b> - used to generate DataSet classes from an XSD schema file.  The\r
190                                                 DataSet classes created can then be used with XML data</li>\r
191                                         <li><b>XSD to Classes</b> - used to generate classes from an XSD schema file. The \r
192                                             classes created can be used with System.XML.Serialization.XMLSerializer \r
193                                             to read and write XML code that follows the schema</li>\r
194                                         <li><b>Classes to XSD</b> - used to generate an XML schema \r
195                                                 from type(s) in a assembly file. The \r
196                                                 XML schema created by the tool defines the XML format used \r
197                                                 by System.XML.Serialization.XMLSerializer</li>\r
198                                         </ul>\r
199                                 <li>Xsd.exe is used to manipulate XML schemas that \r
200                                         follow the http://www.w3.org/XML/Schema">XML Schema Definition (XSD)</a> language \r
201                                         recommended     by the <a href="http://w3.org/">World Wide Web Consortium (W3C)</a></li>\r
202                                         \r
203                                 <li>How this tool could be created:\r
204                                         <ul>\r
205                                                 <li>Write xsd.exe in C# and run on Mono</li>\r
206                                                 <li>Make sure we have XML Schema support in System.Xml.Schema.  Currently,\r
207                                                 it is wrapped around libxlst</li>\r
208                                                 <li>XML serialization support in System.Data classes</li>\r
209                                                 <li>Create the TypedDataSetGenerator class in System.Data</li>\r
210                                                 <li>Using CodeDOM or Reflection.Emit to create code</li>\r
211                                                 <li>Make sure DataSet, XmlDataDocument, and related classes \r
212                                                 are implemented fully</li>\r
213                                         </ul>\r
214                                 </li>   \r
215                                 
216                         </li>
217                         </ul>
218                 </li>
219                 
220                 <li><b>Application XML Configuration File Editor</b> - a tool
221                 to create and edit an application configuration file, such as,
222                 we have a .net application named Accouting.exe, the tool could edit
223                 the application configuration file Accounting.exe.config so a user could
224                 connect to the database used by the program.  This tool has not
225                 been created.</li>
226                 
227                 <li><b>Configuration Command-Line and GUI Tools for ADO.NET</b>.  
228                   These tools have not been started.  The tools would be written in
229                   C# and run on Mono. The
230                   configuration tool can be used to do the following:
231                   <ul> 
232                         <li>bebased on the Application XML Configuration File Editor</li>
233                         <li>setup DSNs for the ODBC and OLE-DB
234                                 providers and configurations for 
235                                 their underlying libraries (unixODBC and libgda)</li>
236                     <li>setup configurations for the Mono.Data.ProviderFactory
237                                 that Brian Ritchie created</li>
238                     <li>setup native database client library configurations too, such as,
239                                 freetds.conf for Microsoft SQL Server and Sybase</li>
240                   </ul>
241                 </li>
242
243 </ul>
244
245 ** Extra Classes in Mono ADO.NET
246
247  <p>An ADO.NET <a href="http://www.go-mono.com/provider-factory.html">Provider Factory</a> 
248     was created by Brian Ritchie.  The 
249         Provider Factory is a way to dynamically create
250         connections, commands, parameters, and data adapters based on configuration 
251         information.
252         
253 ** Current Status
254
255         <p>Various ADO.NET Providers have been created at various stages of 
256         development including: 
257         Firebird/Interbase, IBM DB2 Universal Database, MySQL, ODBC, OLE DB, Oracle,
258         PostgreSQL, SQL Lite, Sybase, Microsoft SQL Server, and TDS Generic.  
259         See their respective web page for more information.
260         
261         <p><b>Data Relations</b> via DataRelation, DataRelationCollection, and
262         other classes have not been implemented
263         
264         <p><b>Constraints</b> need lots of work
265         
266         <p><b>XML Schema Definition tool</b> xsd.exe that is included
267         in the .NET Framework has not been created for Mono
268         
269         <p><b>TypeDataSetGenerator</b> needs to be stubbed and implemented.
270                 
271         <p><b>DataSet, DataAdaptor, DataTable, DataRelation, DataRow, DataColumn,
272         DataColumnCollection, DataRowCollection, and others</b> need more work.  There are
273         many classes that are just stubs and need to be implemented.  Ville Palo has been
274         doing much testing here.
275
276         <p><b>XML support in System.Data</b> needs work.  This involves working on
277         the classes: DataSet, XmlDataDocument, and the method ExecuteXmlReader() that
278         exists in a provider's class that implements IDbCommand, and others.
279         Stuart Caborn has started the XML support in a DataSet.  Tim Coleman started
280         XML support in the ExecuteXmlReader() in a SqlCommand.  Ville Palo has been
281         heavily modifying DataSet, XmlDataDocument, and other classes for reading
282         and writing XML.  XML Serialization support in DataSet needs to be implemented.
283                 
284         <p><b>Integration with ASP.NET</b> has been created.  Data binding of
285         a DataTable in a DataSet to a System.Web.UI.WebControls.DataGrid works.  Data binding
286         of other types works too.
287         
288         <p><b>Database Access from ASP.NET</b>:
289         <ul>
290                 <li>Take a look at xsp in cvs and look at the examples in test: dbpage1.aspx
291                 and dbpage2.aspx:
292                         <ul>
293                                 <li>Notice that the namespace System.Data is imported via <b>import</b></li>
294                                 <li>A NameValueCollection is gotten using ConfigurationSettings.AppSetings. These
295                                 settings are gotten from the file server.exe.config which is a XML file.   The XML
296                                 file has a section appSettings.  In the appSettings section, you have keys 
297                                 for DBProviderAssembly, DBConnectionType, and DBConnectionString.
298                                 <ul>
299                                         <li><b>DBProviderAssembly</b> is the assembly of the ADO.NET provider.  
300                                               For example: 
301                                               "Mono.Data.PostgreSqlClient"</li>
302                                         <li><b>DBConnectionType</b> is the System.Type of the class that 
303                                               implements System.Data.IDbConnection that is found
304                                           in the DBProviderAssembly.  
305                                           For example: 
306                                           "Mono.Data.PostgreSqlClient.PgConnection"</li> 
307                                     <li><b>DBConnectionString</b> is the ConnectionString to set to the
308                                           IDbConnection object to use in opening a connection to a data source.
309                                           For Example: 
310                                           "hostaddr=127.0.0.1;user=monotest;password=monotest;dbname=monotest"</li>
311                                 </ul>
312                                 <li>The function GetConnectionData() gets the database provider assembly, connection type,
313                                 and connection string parameters if they exist; otherwise, it uses default values.  This is
314                                 done during the loading of the web page.</li>
315                                 <li>With the connection parameters, the assembly is loaded, the connection type is verified that
316                                 it implements IDbConnection and an instance of the class can be created, creates a instance
317                                 of the class, sets the connection string, and opens the connection.</li>
318                         </ul>
319                 </li>
320         </ul>
321         
322         <p><b>Integration with Windows.Forms</b> has not been started, such as, data binding 
323         to a System.Windows.Forms.DataGrid.  This may involve implementing many classes
324         in System.Windows.Forms and System.Data.
325         
326         <p><b>Integration with <a href="http://gtk-sharp.sourceforge.net/">GTK#</a></b> 
327         has not been started, such as, data binding
328         to a GtkTreeView.  This may involve creating new classes
329         to go between the glist data model and the ADO.NET data model.
330         Mike Kestner or Rachel Hestilov would be the best people to ask for help on GTK#.
331         
332         <p><b>Integration with QT#</b> has not been started.  Any information on 
333         how this can be done is appreciated.  Adam Treat would be the best 
334         person to ask about QT#.
335         
336         <p><b>Building System.Data</b>
337         
338         <p>The System.Data.dll gets built with the rest of the class library.
339         To compile the System.Data.dll assembly separately, you need:
340
341         <b>On Unix</b>
342
343         <ul>
344                 * update your mono sources. Be sure you have latest mcs.exe
345                   and .dll's, since there have been many fixes needed for
346                   compilation on Linux.
347
348                 * compile System.Data.dll:
349 <pre>
350  cd mcs/class/System.Data<br>
351  mcs --target library -o \
352     System.Data.dll @list
353 </pre>
354         </ul>
355
356         <b>On Windows</b>
357
358         <ul>
359                 * update your mono sources. Be sure you have latest mcs.exe
360                   and .dll's.  You can use the same method as Linux, 
361                   or you can use NAnt.
362
363                 * To use NAnt:
364
365 <pre>
366  cd mcs/class/System.Data
367  ../../nant/NAnt.exe
368 </pre>
369                         
370                 * This will automatically copy the System.Data.dll to Test.
371                   If you need to do a clean for the System.Data.dll assembly,<br><br>
372
373 <pre>
374  cd mcs/class/System.Data
375  ../../nant/NAnt.exe clean 
376 </pre>
377         </ul>
378
379 ** Testing
380
381 <ul>
382         <li>Testing connection-oriented classes are done 
383         via the provider specific tests
384         found in the mcs source at mcs/class</br>
385                 <table border=1>        
386                         <tr>
387                                 <td><b>Name</b></td>
388                                 <td><b>Assembly /</br> Namespace</b></td>
389                                 <td><b>Test</b></td>    
390                         </tr>           
391                         
392                         <tr>
393                                 <td>Microsoft</br> SQL</br> Server</br></td>
394                                 <td>System.Data /</br> System.Data.SqlClient</td>
395                                 <td>SqlTest.cs at</br> System.Data/Test</td>
396                         </tr>
397                         
398                         <tr>
399                                 <td>PostgreSQL</br> (Mono)</td>
400                                 <td>Mono.Data.PostgreSqlClient /</br> Mono.Data.PostgreSqlClient</td>
401                                 <td>PostgresTest.cs at</br> System.Data/Test</td>
402                         </tr>
403
404                         <tr>
405                                 <td>MySQL</br> (Mono)</td>
406                                 <td>Mono.Data.MySql /</br> Mono.Data.MySql</td>
407                                 <td>MySqlTest.cs at</br> Mono.Data.MySql/Test</td>
408                         </tr>
409
410                         <tr>
411                                 <td>Oracle</br> (Mono)</td>
412                                 <td>System.Data.OracleClient /</br> System.Data.OracleClient</td>
413                                 <td>TestOracleClient.cs at</br> System.Data.OracleClient</td>
414                         </tr>
415
416                         <tr>
417                                 <td>ODBC</br> (Mono)</td>
418                                 <td>System.Data.OracleClient /</br> System.Data.OracleClient</td>
419                                 <td>TestOracleClient.cs at</br> System.Data.OracleClient</td>
420                         </tr>
421                         
422                 </table>
423         
424
425         <li><a href="http://www.go-mono.com/testing.html">Testing non-connection classes</a> are 
426         done via mono's modified version of NUnit.
427                 <ul>
428                         <li>To run all the NUnit tests for Mono, you need the mcs source.  cd to the root
429                         of the mcs source.  To run it:
430                                 <ul>
431                                         <li>On Linux: make -f makefile test</li>
432                                         <li>On Windows: make test</li>
433                                 </ul>
434                         </li>
435                         <li>If you just want to run the NUnit tests for System.Data, you would cd into
436                         the mcs source at class/System.Data/Test and run it:
437                                 <ul>
438                                         <li>On Linux: make -f makefile test</li>
439                                         <li>On Windows: make test</li>
440                                 </ul>
441                         </li>
442                 </ul>
443         </li>
444                 
445 </ul>   
446