1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157
|
* 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>
|