Update the links. Thanks for Andy Oliver for the report.
[mono.git] / web / tdsclient
1 * TDS Generic Provider
2
3 <ul>
4         <li>ADO.NET Provider for older Sybase and Microsoft SQL Server databases</li>
5
6         <li>Exists in namespace Mono.Data.TdsClient and assembly Mono.Data.TdsClient</li>
7         
8         <li>Created by Tim Coleman</li>
9         
10         <li>Used the <a href="http://www.freetds.org/">FreeTDS</a> and 
11         <a href="http://jtds.sourceforge.net/">jTDS</a> projects as resources.</li>
12         
13         <li>Implemented in 100% C#</li>
14         
15         <li>Is similar to the Mono.Data.SybaseClient and System.Data.SqlClient providers.</li>
16         
17         <li>Requires the assembly Mono.Data.Tds.dll which implements the TDS protocol in 100% C#.</li>
18         
19         <li>Uses TDS Protocol Version 4.2 by default</li>
20         
21         <li>Does not support trusted connections</li>
22 </ul>
23
24 ** Current Status
25
26
27 <ul>
28         <li>Only builds on Windows currently due to mcs does not support modules and mcs
29         has problems with code that is internal.</li>
30         
31         <li>Able to connect to Microsoft SQL Server and Sybase databases</li>
32         
33         <li>SQL commands can be executed
34         via ExecuteNonQuery() of a TdsCommand.</li>
35         
36         <li>SQL aggregates can be executed and a single row and single column
37         result can be retrieved via ExecuteScalar() of a TdsCommand</li>
38         
39         <li>SQL queries can be executed via ExecuteReader() and results 
40         can be retrieved via TdsDataReader.</li>
41         
42         <li>a DataTable with schema info about a result can be gotten via GetSchemaTable()
43         in a TdsDataReader</li>
44         
45         <li>Data can be filled in a DataTable in a DataSet via a TdsDataAdapter</li>
46 </ul>
47
48 ** Action plan
49
50 <ul>
51         <li>Connection timeouts is being developed now.</li>
52
53         <li>TODO</li>
54 </ul>
55
56 ** Testing
57
58 <ul>
59         <li>Have a working mono and mcs installed</li>
60         
61         <li>Have access to a Sybase or Microsoft SQL Server database 
62         or either download it:
63                 <ul>
64                         <li><a href="http://www.microsoft.com/sql/default.asp">Microsoft SQL Server</a></li>
65                         <li><a href="http://www.sybase.com/downloads">Sybase</a></li>
66                 </ul>
67         </li>
68         
69         <li>Located at mcs/class/System.Data/Test is a test for System.Data.SqlClient
70         named SqlTest.cs and you could use this as a basis for your test.</li>
71         
72         <li>C# Example:
73 <pre>
74  using System;
75  using System.Data;
76  using Mono.Data.TdsClient;
77  
78  public class Test 
79  {
80     public static void Main(string[] args)
81     {
82        string connectionString = 
83           "Server=localhost;" +
84           "Database=pubs;" +
85           "User ID=sa;" +
86           "Password=;";
87        IDbConnection dbcon;
88        dbcon = new TdsConnection(connectionString);
89        IDbCommand dbcmd = dbcon.CreateCommand();
90        string sql = 
91            "SELECT fname, lname " +
92            "FROM employee";
93        dbcmd.ConnectionString = sql;
94        IDataReader reader = dbcmd.ExecuteReader();
95        while(reader.Read()) {
96             string FirstName = reader["fname"];
97             string LastName = reader["lname"];
98             Console.WriteLine("Name: " + 
99                  FirstName + " " + LastName);
100        }
101        // clean up
102        reader.Close();
103        reader = null;
104        dbcmd.Dispose();
105        dbcmd = null;
106        dbcon.Close();
107        dbcon = null;
108     }
109  }
110 </pre>
111         </li>
112         <li>Building C# Example:
113         <ul>
114                 <li>Save the example to a file, such as, TestExample.cs</li>
115                 <li>Build on Linux:
116 <pre>
117         mcs TestExample.cs -r System.Data.dll \
118             -r Mono.Data.TdsClient.dll
119 </pre>
120                 </li>
121                 <li>Build on Windows via Cygwin:
122 <pre>
123         mono C:/cygwin/home/MyHome/mono/install/bin/mcs.exe \
124              TestExample.cs \
125              -lib:C:/cygwin/home/MyHome/mono/install/lib \
126              -r System.Data.dll -r Mono.Data.TdsClient.dll
127 </pre>
128                 </li>
129         </ul>
130         </li>
131         <li>Running the Example:
132 <pre>
133 mono TestExample.exe
134 </pre>
135         </li>
136 </ul>
137