adding jordi as contributor
[mono.git] / web / 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
23         <li>Bugs with Mono or the data provider should be reported 
24         in Mono's Bugzilla <a href="http://bugzilla.ximian.com/">here</a>.  If you
25         do not have Bugzilla user account, it is free 
26         and easy to 
27         create one <a href="http://bugzilla.ximian.com/createaccount.cgi">here</a>.</li>
28
29
30 </ul>
31
32 ** Current Status
33         
34 <ul>    
35         <li>Able to connect to Sybase databases</li>
36         
37         <li>SQL commands can be executed
38         via ExecuteNonQuery() of a SybaseCommand.</li>
39         
40         <li>SQL aggregates can be executed and a single row and single column
41         result can be retrieved via ExecuteScalar() of a SybaseCommand</li>
42         
43         <li>SQL queries can be executed via ExecuteReader() and results 
44         can be retrieved via SybaseDataReader.</li>
45         
46         <li>a DataTable with schema info about a result can be gotten via GetSchemaTable()
47         in a SybaseDataReader</li>
48         
49         <li>Data can be filled in a DataTable in a DataSet via a SybaseDataAdapter</li>
50 </ul>
51
52 ** Action plan
53
54 <ul>
55         <li>Connection timeouts is being developed now.
56         
57         <li>Needs more testing...
58
59 </ul>
60
61 ** Testing
62
63 <ul>
64         <li>Have a working mono and mcs installed</li>
65         
66         <li>Have access to a Sybase database 
67         or either download it:
68                 <ul>
69                         <li><a href="http://www.sybase.com/downloads">Sybase</a></li>
70                 </ul>
71         </li>
72         
73         <li>Located at mcs/class/System.Data/Test is a test for System.Data.SqlClient
74         named SqlTest.cs and you could use this as a basis for your test.</li>
75         
76         <li>Has a connection string format:
77 <pre>
78  Server=hostname;Database=databaseName;User ID=userid;Password=password
79 </pre>
80         </li>
81         <li>The Server part can be used two ways:
82                 <ul>
83                         <li>hostname - "Server=MYHOST"</li>
84                         <li>hostname,port - "Server=MYHOST,1533"</li>
85                 </ul>
86         </li>
87                 
88         <li>C# Example:
89 <pre>
90  using System;
91  using System.Data;
92  using Mono.Data.SybaseClient;
93  
94  public class Test 
95  {
96     public static void Main(string[] args)
97     {
98        string connectionString = 
99           "Server=localhost;" +
100           "Database=pubs;" +
101           "User ID=myuserid;" +
102           "Password=mypassword;";
103        IDbConnection dbcon;
104        dbcon = new SybaseConnection(connectionString);
105        dbcon.Open();
106        IDbCommand dbcmd = dbcon.CreateCommand();
107        string sql = 
108             "SELECT fname, lname " + 
109             "FROM employee";
110        dbcmd.CommandText = sql;
111        IDataReader reader = dbcmd.ExecuteReader();
112        while(reader.Read()) {
113             string FirstName = reader["fname"];
114             string LastName = reader["lname"];
115             Console.WriteLine("Name: " + 
116                  FirstName + " " + LastName);
117        }
118        // clean up
119        reader.Close();
120        reader = null;
121        dbcmd.Dispose();
122        dbcmd = null;
123        dbcon.Close();
124        dbcon = null;
125     }
126  }
127 </pre>
128         </li>
129         <li>Building C# Example:
130         <ul>
131                 <li>Save the example to a file, such as, TestExample.cs</li>
132                 <li>Build on Linux:
133 <pre>
134         mcs TestExample.cs -r System.Data.dll \
135             -r Mono.Data.SybaseClient.dll
136 </pre>
137                 </li>
138                 <li>Build on Windows via Cygwin:
139 <pre>
140         mono C:/cygwin/home/MyHome/mono/install/bin/mcs.exe \
141              TestExample.cs \
142              -lib:C:/cygwin/home/MyHome/mono/install/lib \
143              -r System.Data.dll -r Mono.Data.SybaseClient.dll
144 </pre>
145                 </li>
146         </ul>
147         </li>
148         <li>Running the Example:
149 <pre>
150 mono TestExample.exe
151 </pre>
152         </li>
153
154 </ul>
155