diff options
author | Daniel Morgan <monodanmorg@yahoo.com> | 2004-04-11 04:26:21 +0400 |
---|---|---|
committer | Daniel Morgan <monodanmorg@yahoo.com> | 2004-04-11 04:26:21 +0400 |
commit | 0249cea012a505c1f07d2d6014015ca549831390 (patch) | |
tree | c7cd0f47a5e33223d4d784f90d13a38439784e75 /web/sqlclient | |
parent | 7380b58dec273748f5ef4b40e42f73efbe7cc5c1 (diff) |
2004-04-10 Daniel Morgan <danielmorgan@verizon.net>
* ado-net
* sqlclient
* oracle
* postgresql
* mysql: clean up Mono ADO.NET web pages
* makefile: remove building of obsolete web page tds-providers
svn path=/trunk/mono/; revision=25325
Diffstat (limited to 'web/sqlclient')
-rwxr-xr-x | web/sqlclient | 97 |
1 files changed, 69 insertions, 28 deletions
diff --git a/web/sqlclient b/web/sqlclient index c5eb1f9cc40..eca4906cbe3 100755 --- a/web/sqlclient +++ b/web/sqlclient @@ -31,10 +31,8 @@ <ul> - <li>Thanks to Sebastien Pouliot, we now have NT Authentication (Integrated Security) support. This support was - added after the release of Mono 0.29. So, you either get it from cvs or wait for the Mono 0.30 release.</li> - <li>Able to connect to Microsoft SQL Server 7/2000 databases via SQL Server authentication and NT Authentication.</li> + <li>Connect to Microsoft SQL Server 7/2000 databases via SQL Server authentication and NT Authentication.</li> <li>Connection pooling works.</li> @@ -60,21 +58,20 @@ <li>Data can be filled in a DataTable in a DataSet via a SqlDataAdapter</li> - <li>Uses TDS Protocol Version 7.0</li> - <li>Works in the SQL# command-line and GTK# GUI version</li> </ul> ** Action plan <ul> - <li>Connection timeouts is being developed now</li> - <li>Needs more testing</li> + <li>Needs more testing and fixing bugs</li> <li>Start work on TDS Protocol Version 8.0 support</li> - <li>Add support for .NET 1.2 and 2.0 and Microsoft SQL Server (Yukon) support</li> + <li>Add support for the .NET Framework 2.0 (Whidbey)</li> + + <li>Add support for Microsoft SQL Server 2005 (Yukon) support</li> </ul> @@ -99,8 +96,8 @@ from Windows Only Authentication to SQL Server and Windows Authentications (also knows as Mixed-mode authentication)
via the <a href="http://support.microsoft.com/default.aspx?scid=kb;en-us;Q322336&sd=tech#4">registry</a></li>. It is
the LoginMode you need to change. By default,
- MSDE is installed with Windows Only Authentication. For SqlClient to work with MSDE, you will
- need to change the setting.</a>
+ MSDE is installed with Windows Only Authentication. If you want SqlClient to work with MSDE via SQL Server authentication, you will
+ need to change the setting. Otherwise, you wil have to use NT Authentication.</a>
<li>If using MSDE, you might need to create a new user with password. Give
this user access to various databases in this MSDE instance. Also, for each
@@ -111,26 +108,32 @@ for both MSDE and Microsoft SQL Server. To change the authentication mode in
Enterprise Mananger, select the instance, right-click on it, and select properites.
The SQL Server properties dialog for that instance will pop up. Choose the Security
- tab. Change the authentication from Windows Only to SQL Server and Windows. If
+ tab. Change the Authentication from Windows Only to SQL Server and Windows. If
the instance of your database does not show up in Enterprise Manager, Register first
by selecting the Action menu and choosing New SQL Server Registration.</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>Mono's SqlClient does not support trusted connections - nor integrated security. You can not use this when connecting. You need - to explicitly use a User ID and Password - authenticated by SQL Server.</li> + <li>If you want to use Integrated Security (aka NT Authentication aka Trusted Connection aka Domain Login), you + will need to specify the Domain User ID and Password. This is because Mono is not integrated with Windows + nor SQL Server.</li> <li>Has a connection string format for SQL Server Authentication: <pre> - Server=hostname;Database=databaseName;User ID=userid;Password=password + Server=hostname; + Database=databaseName; + User ID=sqlServerUserid; + Password=sqlServerPassword </pre> </li> <li>Has a connection string format for NT Authentication: <pre> - Server=hostname;Database=databaseName;User ID=windowsUserid;Password=windowsPassword;Integrated Security=SSPI + Server=hostname; + Database=databaseName; + User ID=windowsDomain\windowsUserid; + Password=windowsPassword; + Integrated Security=SSPI </pre> </li> @@ -150,12 +153,12 @@ </tr> <tr> - <td>hostname\\instance</td> <td>Server=MYHOST\\NETSDK</td> + <td>hostname\instance</td> <td>Server=MYHOST\NETSDK</td> </tr> </table> </li> - <li>C# Example: + <li>C# Example using SQL Server Authentication: <pre> using System; using System.Data; @@ -166,10 +169,10 @@ public static void Main(string[] args) { string connectionString = - "Server=localhost;" + + "Server=MyServer;" + "Database=pubs;" + - "User ID=myuserid;" + - "Password=mypassword;"; + "User ID=MySqlServerUserId;" + + "Password=MySqlServerPassword;"; IDbConnection dbcon; dbcon = new SqlConnection(connectionString); dbcon.Open(); @@ -196,6 +199,50 @@ } </pre> </li> + + <li>C# Example using NT Authentication (Integrated Security) +<pre> + using System; + using System.Data; + using System.Data.SqlClient; + + public class Test + { + public static void Main(string[] args) + { + string connectionString = + "Server=MyServer;" + + "Database=pubs;" + + "User ID=MyWindowsDomain\\MyWindowsUserid;" + + "Password=MyWindowsPassword;" + + "Integrated Security=SSPI"; + IDbConnection dbcon; + dbcon = new SqlConnection(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> @@ -204,12 +251,6 @@ mcs TestExample.cs -r System.Data.dll </pre> </li> - <li>Build on Windows via Cygwin: -<pre> - mono C:/cygwin/home/MyHome/mono/install/bin/mcs.exe \ - TestExample.cs -r System.Data.dll -</pre> - </li> </ul> </li> <li>Running the Example: |