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