[Mono-list] Trusted_connection with the ADO.NET providers

Daniel Morgan danmorg@sc.rr.com
Sat, 21 Dec 2002 12:01:44 -0500


Hello Bob,

You are trying to use trusted connections.  None of the data providers in
Mono support trusted connections (Windows Authentication).  When connecting,
let the database server authenticate the user.  A default installation of
Microsoft SQL Server 2000 only does Windows authentication.  You have to
change this to Mixed mode or SQL Server authentication mode.

Here is a connection string for an ODBC DSN that uses SQL Server
authentication to connect to a Microsoft SQL Server 7/2000:

"DSN=SqlServerDsn;UID=someuser;PWD=somepass"

Here is a connection string for the SqlClient data provider:

"Server=MYCOMPUTERNAME;Database=pubs;User ID=someuser;Password=somepass"

Make sure the SQL Server database is set to authenticate the user via SQL
Server.

If you want to learn more about how to get the SqlClient and ODBC data
providers to use Windows or Windows Domain Authentication, try contacting
the FreeTDS developers.  I believe these people have found a way to connect
to SQL Server with Windows Domain authentication from a non-windows machine.
See http://www.freetds.org/ and subscribe to their mailing list.

Daniel

-----Original Message-----
From: mono-list-admin@ximian.com [mailto:mono-list-admin@ximian.com]On
Behalf Of B Johnson
Sent: Saturday, December 21, 2002 9:33 AM
To: mono-list@ximian.com
Subject: [Mono-list] Re: Mono-list digest, Vol 1 #660 - 22 msgs


Hello,

I was just looking at the features that are available for the ODBC Data
Provider on the web site and  I decided to write up some test code for
"Insert", "Delete", Update". I just compiled my Insert test (Which is using
an Access 200 database) and the code compiles ok with mono but the insert is
not happening. I also compile this same code with CSC and the code does
insert the recode ok.  The OS I am using to test this is windows XP
Professional. I have attached the code I used at the end of my posting.

I also have a question. Is it ok to do more of this kind of ODBC testing? IS
there some sort of test plan to use for these types of test?

Bob J

My test Code:
// created on 12/21/2002 at 8:33 AM

//

// OdbcTest.cs - Test for the ODBC ADO.NET Provider in System.Data.Odbc

//

//

//

//

// Author:

// Bob Johnson <bobjohnson11@comcast.net>

//

using System;

using System.Data;

using System.Data.Odbc;

namespace Test.OdbcInsertTest

{

class OdbcInsertTest

{

[STAThread]

static void Main(string[] args)

{

OdbcConnection dbcon = new OdbcConnection();

// connection string to a Microsoft SQL Server 2000 database

// that does not use a DSN

//dbcon.ConnectionString =

// "DRIVER={SQL Server};" +

// "SERVER=(local);" +

// "Trusted_connection=true;" +

// "DATABASE=pubs;";

// connection string that uses a DSN.

dbcon.ConnectionString =

"DSN=testdb;UID=sa;PWD=";

int rowsAffected;

dbcon.Open();

OdbcCommand dbcmd = new OdbcCommand();

dbcmd.Connection = dbcon;

dbcmd.CommandType = CommandType.Text;

//dbcmd.CommandText = "SELECT LastName FROM address";

dbcmd.CommandText = "Insert into Address" + "(FirstName, LastName, Phone)" +
"values ('Robert', 'Johnson', '212-111-1111')";

rowsAffected= dbcmd.ExecuteNonQuery();

Console.WriteLine ("Rows Affected: " + rowsAffected);

dbcon.Close();


}

}

}