| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157 |
- * TDS Generic Provider
- <ul>
- <li>ADO.NET Provider for older Sybase and Microsoft SQL Server databases</li>
- <li>Exists in namespace Mono.Data.TdsClient and assembly Mono.Data.TdsClient</li>
-
- <li>Created by Tim Coleman</li>
-
- <li>Used the <a href="http://www.freetds.org/">FreeTDS</a> and
- <a href="http://jtds.sourceforge.net/">jTDS</a> projects as resources.</li>
-
- <li>Implemented in 100% C#</li>
-
- <li>Is similar to the Mono.Data.SybaseClient and System.Data.SqlClient providers.</li>
-
- <li>Requires the assembly Mono.Data.Tds.dll which implements the TDS protocol in 100% C#.</li>
-
- <li>Uses TDS Protocol Version 4.2 by default</li>
-
- <li>Bugs with Mono or the data provider should be reported
- in Mono's Bugzilla <a href="http://bugzilla.ximian.com/">here</a>. If you
- do not have Bugzilla user account, it is free
- and easy to
- create one <a href="http://bugzilla.ximian.com/createaccount.cgi">here</a>.</li>
- </ul>
- ** Current Status
- <ul>
- <li>Only builds on Windows currently due to mcs does not support modules and mcs
- has problems with code that is internal.</li>
-
- <li>Able to connect to Microsoft SQL Server and Sybase databases</li>
-
- <li>SQL commands can be executed
- via ExecuteNonQuery() of a TdsCommand.</li>
-
- <li>SQL aggregates can be executed and a single row and single column
- result can be retrieved via ExecuteScalar() of a TdsCommand</li>
-
- <li>SQL queries can be executed via ExecuteReader() and results
- can be retrieved via TdsDataReader.</li>
-
- <li>a DataTable with schema info about a result can be gotten via GetSchemaTable()
- in a TdsDataReader</li>
-
- <li>Data can be filled in a DataTable in a DataSet via a TdsDataAdapter</li>
- </ul>
- ** Action plan
- <ul>
- <li>Connection timeouts is being developed now.</li>
- <li>TODO</li>
- </ul>
- ** Testing
- <ul>
- <li>Have a working mono and mcs installed</li>
-
- <li>Have access to a Sybase or Microsoft SQL Server database
- or either download it:
- <ul>
- <li><a href="http://www.microsoft.com/sql/default.asp">Microsoft SQL Server</a></li>
- <li><a href="http://www.sybase.com/downloads">Sybase</a></li>
- </ul>
- </li>
- <li>If using Microsoft SQL Server 2000, make sure
- you are using at least Service Pack 3 for Microsoft SQL Server 2000</li>
-
- <li>Located at mcs/class/System.Data/Test is a test for System.Data.SqlClient
- named SqlTest.cs and you could use this as a basis for your test.</li>
-
- <li>Has a connection string format:
- <pre>
- Server=hostname;Database=databaseName;User ID=userid;Password=password
- </pre>
- </li>
- <li>The Server part can be used two ways:
- <ul>
- <li>hostname - "Server=MYHOST"</li>
- <li>hostname,port - "Server=MYHOST,1533"</li>
- </ul>
- </li>
-
- <li>C# Example:
- <pre>
- using System;
- using System.Data;
- using Mono.Data.TdsClient;
-
- public class Test
- {
- public static void Main(string[] args)
- {
- string connectionString =
- "Server=localhost;" +
- "Database=pubs;" +
- "User ID=myuserid;" +
- "Password=mypassword;";
- IDbConnection dbcon;
- dbcon = new TdsConnection(connectionString);
- dbcon.Open();
- IDbCommand dbcmd = dbcon.CreateCommand();
- string sql =
- "SELECT fname, lname " +
- "FROM employee";
- dbcmd.CommandText = sql;
- IDataReader reader = dbcmd.ExecuteReader();
- while(reader.Read()) {
- string FirstName = (string) reader["fname"];
- string LastName = (string) reader["lname"];
- Console.WriteLine("Name: " +
- FirstName + " " + LastName);
- }
- // clean up
- reader.Close();
- reader = null;
- dbcmd.Dispose();
- dbcmd = null;
- dbcon.Close();
- dbcon = null;
- }
- }
- </pre>
- </li>
- <li>Building C# Example:
- <ul>
- <li>Save the example to a file, such as, TestExample.cs</li>
- <li>Build on Linux:
- <pre>
- mcs TestExample.cs -r System.Data.dll \
- -r Mono.Data.TdsClient.dll
- </pre>
- </li>
- <li>Build on Windows via Cygwin:
- <pre>
- mono C:/cygwin/home/MyHome/mono/install/bin/mcs.exe \
- TestExample.cs \
- -lib:C:/cygwin/home/MyHome/mono/install/lib \
- -r System.Data.dll -r Mono.Data.TdsClient.dll
- </pre>
- </li>
- </ul>
- </li>
- <li>Running the Example:
- <pre>
- mono TestExample.exe
- </pre>
- </li>
- </ul>
|