* LifetimeServices.cs: Implemented all methods.
[mono.git] / doc / sybase
1 * Sybase Data Provider
2
3 <ul>
4         <li>ADO.NET Provider for Sybase SQL Server databases</li>
5
6         <li>Exists in namespace Mono.Data.SybaseClient and assembly Mono.Data.SybaseClient</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.TdsClient 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 5.0</li>
20         
21         <li>Does not support trusted connections</li>
22 </ul>
23
24 ** Current Status
25         
26 <ul>    
27         <li>Able to connect to Sybase databases</li>
28         
29         <li>SQL commands can be executed
30         via ExecuteNonQuery() of a SybaseCommand.</li>
31         
32         <li>SQL aggregates can be executed and a single row and single column
33         result can be retrieved via ExecuteScalar() of a SybaseCommand</li>
34         
35         <li>SQL queries can be executed via ExecuteReader() and results 
36         can be retrieved via SybaseDataReader.</li>
37         
38         <li>a DataTable with schema info about a result can be gotten via GetSchemaTable()
39         in a SybaseDataReader</li>
40         
41         <li>Data can be filled in a DataTable in a DataSet via a SybaseDataAdapter</li>
42 </ul>
43
44 ** Action plan
45
46 <ul>
47         <li>Connection timeouts is being developed now.
48         
49         <li>Needs more testing...
50
51 </ul>
52
53 ** Testing
54
55 <ul>
56         <li>Have a working mono and mcs installed</li>
57         
58         <li>Have access to a Sybase database 
59         or either download it:
60                 <ul>
61                         <li><a href="http://www.sybase.com/downloads">Sybase</a></li>
62                 </ul>
63         </li>
64         
65         <li>Located at mcs/class/System.Data/Test is a test for System.Data.SqlClient
66         named SqlTest.cs and you could use this as a basis for your test.</li>
67         
68         <li>C# Example:
69 <pre>
70  using System;
71  using System.Data;
72  using Mono.Data.SybaseClient;
73  
74  public class Test 
75  {
76     public static void Main(string[] args)
77     {
78        string connectionString = 
79           "Server=localhost;" +
80           "Database=pubs;" +
81           "User ID=myuserid;" +
82           "Password=mypassword;";
83        IDbConnection dbcon;
84        dbcon = new SybaseConnection(connectionString);
85        IDbCommand dbcmd = dbcon.CreateCommand();
86        string sql = 
87             "SELECT fname, lname " + 
88             "FROM employee";
89        dbcmd.CommandText = sql;
90        IDataReader reader = dbcmd.ExecuteReader();
91        while(reader.Read()) {
92             string FirstName = reader["fname"];
93             string LastName = reader["lname"];
94             Console.WriteLine("Name: " + 
95                  FirstName + " " + LastName);
96        }
97        // clean up
98        reader.Close();
99        reader = null;
100        dbcmd.Dispose();
101        dbcmd = null;
102        dbcon.Close();
103        dbcon = null;
104     }
105  }
106 </pre>
107         </li>
108         <li>Building C# Example:
109         <ul>
110                 <li>Save the example to a file, such as, TestExample.cs</li>
111                 <li>Build on Linux:
112 <pre>
113         mcs TestExample.cs -r System.Data.dll \
114             -r Mono.Data.SybaseClient.dll
115 </pre>
116                 </li>
117                 <li>Build on Windows via Cygwin:
118 <pre>
119         mono C:/cygwin/home/MyHome/mono/install/bin/mcs.exe \
120              TestExample.cs \
121              -lib:C:/cygwin/home/MyHome/mono/install/lib \
122              -r System.Data.dll -r Mono.Data.SybaseClient.dll
123 </pre>
124                 </li>
125         </ul>
126         </li>
127         <li>Running the Example:
128 <pre>
129 mono TestExample.exe
130 </pre>
131         </li>
132
133 </ul>
134