RE: Connet to SQL Server?

From: Cowboy (Gregory A. Beamer) - MVP (NoSpamMgbworld_at_comcast.netNoSpamM)
Date: 09/29/04


Date: Wed, 29 Sep 2004 08:05:02 -0700

Mixed mode security works wonders. Good catch!

---
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
***************************
Think Outside the Box!
***************************
"Welles" wrote:
> I just figured out the problem... and the way to solve it is to go to 
> Enterprise Manager, select server properties and on the Security tab change 
> Authentication mode to 'SQL Server and Windows'.
> 
> 
> "Welles" wrote:
> 
> > I am a newbie to both .Net and Sql Server and I am trying to access the 
> > database by using the ADO.Net data reader. This is actually one of the 
> > execises in a book that I am reading. However, when I run this program, there 
> > is an error saying that "Login failed for user 'sa'. Reason: Not associated 
> > with a trusted SQL Server connection." Are there some settings I have to 
> > change in the Sql Server? Please help me!
> > 
> > //--------------------------------------------------------------
> > using System;
> > using System.Data;
> > using System.Data.SqlClient;
> > 
> > class MyApp
> > {
> > 	static void Main()
> > 	{	
> > 		try{
> > 			SqlConnection conn = new 
> > SqlConnection("server=localhost;uid=sa;pwd=;database=pubs");
> > 			conn.Open();
> > 			
> > 			SqlCommand comm = new SqlCommand("select * from titles", conn);
> > 			SqlDataReader reader = comm.ExecuteReader();
> > 			
> > 			while(reader.Read())
> > 				Console.WriteLine(reader.GetString(1));
> > 				
> > 			conn.Close();
> > 		}
> > 		
> > 		catch(Exception e){
> > 			Console.WriteLine(e.Message);
> > 		}		
> > 	}
> > }
> > 
> > //--------------------------------------------------------------


Relevant Pages

  • RestrictAnonymous=2 Question
    ... I am installing SQL Server 2000 and I ran Microsoft's Baseline ... Security Analyzer and it suggested that I change the ... a mixed mode security. ... mix mode authentication setting? ...
    (microsoft.public.sqlserver.security)
  • Re: Can authentication mode be changed after installation
    ... To set up Mixed Mode security ... Microsoft® SQL ServerT are recorded in the SQL Server error log: ... Auditing failed login attempts helps determine if unauthorized ...
    (microsoft.public.sqlserver.programming)