Welcome to mirror list, hosted at ThFree Co, Russian Federation.

sybase « web - github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 85deca1a67cd8afd5c38660f407d40e5db0d6f81 (plain)
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
* Sybase Data Provider

<ul>
	<li>ADO.NET Provider for Sybase SQL Server databases</li>

	<li>Exists in namespace Mono.Data.SybaseClient and assembly Mono.Data.SybaseClient</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.TdsClient 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 5.0</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>Able to connect to Sybase databases</li>
	
	<li>SQL commands can be executed
	via ExecuteNonQuery() of a SybaseCommand.</li>
	
	<li>SQL aggregates can be executed and a single row and single column
	result can be retrieved via ExecuteScalar() of a SybaseCommand</li>
	
	<li>SQL queries can be executed via ExecuteReader() and results 
	can be retrieved via SybaseDataReader.</li>
	
	<li>a DataTable with schema info about a result can be gotten via GetSchemaTable()
	in a SybaseDataReader</li>
	
	<li>Data can be filled in a DataTable in a DataSet via a SybaseDataAdapter</li>
</ul>

** Action plan

<ul>
	<li>Connection timeouts is being developed now.
	
	<li>Needs more testing...

</ul>

** Testing

<ul>
	<li>Have a working mono and mcs installed</li>
	
	<li>Have access to a Sybase database 
	or either download it:
		<ul>
			<li><a href="http://www.sybase.com/downloads">Sybase</a></li>
		</ul>
	</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.SybaseClient;
 
 public class Test 
 {
    public static void Main(string[] args)
    {
       string connectionString = 
          "Server=localhost;" +
          "Database=pubs;" +
          "User ID=myuserid;" +
          "Password=mypassword;";
       IDbConnection dbcon;
       dbcon = new SybaseConnection(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.SybaseClient.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.SybaseClient.dll
</pre>
		</li>
	</ul>
	</li>
	<li>Running the Example:
<pre>
mono TestExample.exe
</pre>
	</li>

</ul>