X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=web%2Fado-net;h=0095d79ef79996374030641fce45c5c8a01272ac;hb=80496539cbb4d78d3cdd2806fe45a75d956f53a4;hp=516c1c74d6e6f61b33feedfc55e39ec3dbfe1583;hpb=ea380d9f671a175f665ecd66e554c51f1f00d0cd;p=mono.git diff --git a/web/ado-net b/web/ado-net index 516c1c74d6e..0095d79ef79 100644 --- a/web/ado-net +++ b/web/ado-net @@ -1,405 +1,198 @@ * ADO.NET - The coordinator for the ADO.NET implementation is - Rodrigo Moya, - with the collaboration of: - Daniel Morgan, - Tim Coleman, - Brian Ritchie, and - Vladimir Vukicevic. - - -* Action plan - - The current plan to implement ADO.NET is as follows: - - Step 1:System.Data.OleDb Provider: - -
On Unix systems: System.Data.OleDb uses the - LibGDA - engine. This provider was started by Rodrigo Moya and Tim Coleman. - -
LibGDA is a data access engine like ADO/OLE-DB, but for Unix. The - GDA in libGDA stands for GNU/GNOME Data Access, but it does not require GNOME. - It only requires glib2 and libxml2. LibGDA is used by - libgnomedb, GNOME-DB, and gaSQL. glib2 and libxml2 both work on Linux - and Windows. - -
There is work under way to get libgda working under - Windows using Cygwin by the GNOME-DB developers, but we have not - been successful yet. - -
LibGDA has providers for - MySQL, - PostgreSQL, - XML, - ODBC (via unixODBC), - Oracle, - Interbase, - Sybase and - Microsoft SQL Server ( - via FreeTDS), - IBM DB2 Universal Database, - SQL Lite, - and MS Access - (via MDB Tools). - -
System.Data.SqlClient will become a - provider for Microsoft SQL Server, both on Windows and - Linux, to be compatible with applications written - for the Microsoft .NET Development Framework. - - *
The SqlClient and SybaseClient Design - states that System.Data.SqlClient will be written completely in - C#. FreeTDS and jTDS projects will be used as references on how to - implement the TDS protocol. SqlClient will use common internal code with SybaseClient - and TdsClient. - - *
FreeTDS - is a collection of free native C libraries: tds, dblib, - and ctlib for accessing TDS protocol databases like - Microsoft SQL Server and Sybase. - - *
jTDS - is a 100% Java JDBC Provider implementing the TDS protocol - which allows data access to Microsoft SQL Server and - Sybase databases. - -
On Unix, the provider uses unixODBC - for its ODBC connectivity. The ODBC provider uses the libodbc.dll that - comes with unixODBC. - -
There is an alternative to unixODBC, iODBC, - but it has not been tested with the ODBC provider. - - * On Windows, the provider uses the native ODBC libraries (odbc32.dll) that comes - with Windows since unixODBC is supposed to be compatible with that. - If you do not have odbc32.dll on Windows, get the latest MDAC - from Microsoft. - - *
The mapping between these native shared libraries is handled - in etc/mono/config - -
In mono cvs, the file is mono/data/config.in - -
unixODBC has providers for: - Oracle, Microsoft SQL Server and Sybase (via FreeTDS), - MySQL, PostgreSQL, Informix, IBM DB2 Universal Database, - Interbase, miniSQL (mSQL), AdabasD, Empress, Ingres, Sap DB, and others. - -
The idea in Microsoft .NET System.Data is to have - a managed provider for each supported DBMS. - -
System.Data.SqlClient for Microsoft SQL Server. See the - Mono.Data.TdsClient provider. - -
Mono.Data.TdsClient for older Microsoft SQL Server - and Sybase databases. This has been started by Tim Coleman - and will provide the functionality for System.Data.SqlClient - and Mono.Data.SybaseClient. - -
Mono.Data.SybaseClient for Sybase SQL Server. See the - Mono.Data.TdsClient provider. - -
Mono.Data.PostgreSqlClient for PostgreSQL. Started by - Rodrigo Moya, Daniel Morgan, and Tim Coleman. This provider - uses the PostgreSQL C API (libpq.so on Linux and pq.dll on - Windows). - -
Mono.Data.MySql for MySQL client/server database. Started by - Daniel Morgan using C# Bindings to MySQL from Brad Meril. - This provider uses the MySQL C API (libmysqlclient.so on - Linux and libmySQL.dll on Windows). - -
Mono.Data.SqliteClient for the SQL Lite database. Started by - Vladimir Vukicevic. This provider uses - SQL Lite database engine. - It is used in mPhoto. - -
See Current Status for more information on these providers. - -
Some providers we would like to have are - Mono.Data.DB2, Mono.Data.miniSQL, - System.Data.OracleClient, Mono.Data.Interbase, - Mono.Data.Berkeley, and SapDB. - Others, of course, are welcomed. - -
SQL# CLI - a command-line tool to execute SQL commands, - test connection strings, and connect to various ADO.NET - providers in Mono. The SQL# CLI has been started on and can be found in - mcs/tools/SqlSharp/SqlSharpCli.cs - It is written in C# and runs on Mono and .NET - - *
SQL# GUI - a GUI tool to execute SQL commands. This - has not been started. The idea is to use the GnomeDbSqlEditor, - GnomeDbBrowser, and GnomeDbGrid gtk+ widgets that exists - in libgnomedb# that is part of gtk#. However, we could base it - on System.Windows.Forms, but System.Windows.Forms in Mono - is not as complete as gtk#. - -
libgnomedb uses libgda for its data model and data access capabilities and - can be found here. libgnomedb# - and gda# are part of gtk# - libgnomedb# is the C# bindings to libgnomedb which is a gtk+ GUI - widget library for data access. - gda# is the C# bindings to libgda which is a generic data access - library that has providers for many databases. - - *
ADO.NET Configuration command-line and GUI tools. These tools have - not been started. They could become a part of SQL# though. The - configuration tool can be used to set up DSNs for the ODBC and OLE-DB - providers. The tools would be written in C# and run on Mono. - -
ThePostgreSQL
provider as Mono.Data.PostgreSqlClient can connect, - execute commands, retrieve data via a Data Reader, read data in a DataTable - in a DataSet via a Data Adapter, get a DataTable holding schema data, - and use input parameters in its SQL, and SQL errors and exceptions for PostgreSQL - are working. +The PostgreSQL provider - has been moved from System.Data.SqlClient to Mono.Data.PostgreSqlClient - so System.Data.SqlClient can be used for the Microsoft SQL Server provider. - -
System.Data.OleDb is working with libgda (an OLE-DB/ADO data access for Unix). - The C-Sharp bindings to libgda currently work - meaning they can compile, run, and you can connect to a - PostgreSQL database via libgda via the C-Sharp bindings to libgda. Basic - functionality (execution of commands, data retrieval, transactions, etc) are - now working. Current focus is on filling up the missing pieces (Data adapters - mainly) and schema support. We need help building libgda on Windows though. libgda - builds find on linux though. An inital implementation of GetSchemaTable() for - the OleDbDataReader has been checked into cvs. GetSchemaTable() isn't correct for OleDb, - but the foundation is there. - -
Tim Coleman has just started on the TDS protocol support neccessary for the - SqlClient, SybaseClient, and TdsClient providers. The provider will be - implemented in pure managed C#. We are using FreeTDS and jTDS as references. - The TDS provider will exist in Mono.Data.TdsClient. - The System.Data.SqlClient and Mono.Data.SybaseClient will - be based off of Mono.Data.TdsClient provider. Currently, we are providing - the foundation for the TdsClient provider. Next step is to implement the TDS - protocol in C#. - -
ODBC support has been started by Brian Ritchie. - It uses unixODBC on Linux and uses native ODBC support on Windows. - There is basic implementations of - OdbcConnection, OdbcCommand, OdbcDataReader, OdbcParameter, and - OdbcParameterCollection. The provider can execute queries and display result sets - (and ExecuteNonQuery too). Currently, developers are working on the Parameter & - Transaction support. It was tested on Debian against a DB2 7.2 UDB. It was - also tested on Windows XP against a Microsoft SQL Server 2000 database. - -
Mono.Data.MySql is an ADO.NET provider for - the MySQL client/server database management system - that uses the MySQL C Client Library. Currently, we can connect, - execute simple commands, and - retrieve results using a data reader. A schema DataTable has been partially - implemented which is returned from GetSchemaTable() in MySqlDataReader. - The shared client libraries - between windows version and linux are different: windows has libmySQL.dll - while linux has libmysqlclient.so. This is handled by the - file etc/mono/config which is mapped by the mono runtime in knowing - which native shared library to load. In cvs, this file is mono/config.in and - can be modified with a text editor. - The C# Bindings to MySQL are thanks to Brad Meril. +
Mono.Data.SqliteClient is an ADO.NET provider for - the SQL Lite - database. There is SQL Lite binaries for Linux and Windows. sqlite.dll on Windows - and sqlite.so on Linux. The SQL Lite proivder - was contributed by Vladimir Vukicevic. - -
DataSet, DataAdaptor, DataTable, DataRelation, DataRow, DataColumn, - DataColumnCollection, DataRowCollection, and others need more work. There are - many classes that are just stubs and need to be implemented. - -
Integration with ASP.NET has not been started, such as, data binding - to a System.Web.UI.WebControls.DataGrid. This may involve implementing many classes - in System.Web and System.Data. Gonzalo, Gaurav, Leen, Patrik, Duncan, and others are - working very hard on the ASP.NET support. If you want to help, - contact Gonzalo Paniagua Javier - -
Integration with Windows.Forms has not been started, such as, data binding - to a System.Windows.Forms.DataGrid. This may involve implementing many classes - in System.Windows.Forms and System.Data. - -
Integration with GTK# - has not been started, such as, data binding - to a GtkTreeView. This may involve creating new classes - to go between the glist data model and the ADO.NET data model. - Mike Kestner would be the best person to ask for help on GTK#. - -
Integration with QT# has not been started. Any information on - how this can be done is appreciated. Adam Treat would be the best - person to ask about QT#. - -
Integration with GDA# has not been started. It is - included in the GTK# project, GDA# - does not require GTK+ nor GNOME. GDA# is C# bindings - to GDA which - is an ADO/OLE-DB like layer for Linux provided as a C library. Classes - that would bind data between the ADO.NET data model and the GDA data model will - need to be created. Rodrigo Moya is the best person to contact about this. - -
Integration with GnomeDb# has not been started. It is - included in the GTK# project and uses GDA# for its data access model. - Creating classes to bind data between the data model in ADO.NET - and the data model that exists in GDA# and GnomeDb# will - need to be started. GnomeDb# is C# bindings to - GnomeDb which uses - GDA as its data access layer. GnomeDb - is a C API in a library that contains - gtk+ widgets (GUI controls) for data access. There are some nifty widgets - (GUI controls) that can be used, such as, GnomeDbGrid, GnomeDbBrowswer, - GnomeDbSqlEditor, GnomeDbList, GnomeDbLogin, GnomeDbReportEditor, GnomeDbTableEditor, - GnomeDbCombo, and GnomeDbForm. Rodrigo Moya is the best person to contact. - -
XML support in System.Data needs to be started. This involves working on - the classes: DataSet, XmlDataDocument, and the method ExecuteXmlReader() that - exists in a provider's class that implements IDbCommand, and others. - -
ADO.NET Multiplexor Provider needs to be created. This is not - part of Microsoft .NET, but it needs to be able to run on Microsoft .NET - and Mono. This provider can be a generic provider, much like the ODBC.NET and - OLEDB.NET providers are, but be written in 100% C# and be configurable via - a configuration file. This provider will multiplex to other providers - that exist. If one does not exist for a given DBMS, - default to the ODBC or OLEDB .NET provider. Or it could be a class - that its sole duty is to dynamically create a provider's Connection class - based on a configuration file. It can provide some utility functions as - well that can be used in all or most of the providers, such as, what - parameter marker character should be used: a colon, at, question mark, - or square brackets. +
According to Gonzalo, this is how it could be implemented: - -
After some work done in System.Configuration, you can now do something - like: - -
-
- // Get an instance of the multiplexor from machine.config file - // Can be overriden in the application config file - object o = ConnectionSettings.GetConfig ("mono.data/multiplexor"); - if (o == null) - --- error - - Multiplexor mp = (Multiplexor) o; - - // may be a string [] argument can help passing arguments - IDbConnection cnc = mp.CreateConnection (providerName); - - and in the machine.config file: - -+** ADO.NET Data Providers -- - - validate="false" tells MultiplexorSectionHandler not to load the Type - until an instance is required. You can add more attributes or whatever - inside- - .... - - ... -- -- -- as long as MultiplexorSectionHandler parses it. - - public class MultiplexorSectionHandler : - IConfigurationSectionHandler - { - public object Create (object parent, object configContext, - XmlNode section) - { - Multiplexor mp; - // Here you get the ChildNodes and set up a Multiplexor - // instance that will hold the information needed to create - // instances of each provider. Only one instance will be - // created by the config system. - return mp; - } - } - - This way, if our providers works with MS, the user can test them in both - MS and mono by just adding a few lines to machine.config (i still have - to upload a default machine.config file for mono). And this is the .NET - way of doing it (of course, if you prefer, you can use the other config - file. I just wanted to make people aware of this feature that now works - on mono). -
Building System.Data - -
The System.Data.dll gets built with the rest of the class library. - To compile the System.Data.dll assembly separately, you need: - - On Unix - +
Mono has many ADO.NET Data Providers to get you connected: + +
External Projects that have created ADO.NET Providers that work on Mono: + +
Some tools that can be used for ADO.NET and other technologies (ASP.NET, XML, etc). + +
An ADO.NET Provider Factory + was created by Brian Ritchie. The + Provider Factory is a way to dynamically create + connections, commands, parameters, and data adapters based on configuration + information. + +** Database Access from ASP.NET
- cd mcs/class/System.Data+
- mcs --target library -o System.Data.dll @list -
- cd mcs/class/System.Data - ../../nant/NAnt.exe - +** Testing + +
Name | +Assembly / Namespace | +Test | +
Microsoft SQL Server | +System.Data / System.Data.SqlClient | +SqlTest.cs at System.Data/Test | +
PostgreSQL (Npgsql) | +Npgsql / Npgsql | +*.cs at Npgsql/Test | +
Oracle (Mono) | +System.Data.OracleClient / System.Data.OracleClient | +TestOracleClient.cs at System.Data.OracleClient/Test | +
ODBC (Mono) | +System.Data.Odbc / System.Data | +OdbcTest.cs (to connect to MS SQL Server)at System.Data/Test | +