Re: Cannot connect using sa



Make sure you have it configured to allow both SQL Server
and Windows authentication. Looks like it might be set to
Windows authentication only.

-Sue

On Mon, 26 Dec 2005 16:56:05 -0700, "ralph"
<vralphv@xxxxxxxxxxxxx> wrote:

>I downloaded C# 2005 Express and downloaded sql 2005 Express at the same
>time.
>It installed without giving me a chance to set a password.
>I am able to connect to it using sqlcmd -E -S localhost\SQLEXPRESS but
>not if I use sqlcmd -S localhost\SQLEXPRESS -U and type in the password.
>I get
>Login failed for user 'sa' . The user is not associated with a trusted SQL
>Server
>connection.
>
>I set using ALTER LOGIN sa WITH PASSWORD = 'mypassword'
>Now I used an example program in c# for Java Developers, changing it a bit.
>I put in a connection string containing User ID=sa;PASSWORD=mypassword;
>I was able to connect to Northwind, but when I tried to select from table
>Customers it said invalid object 'Customers'.
>
>Then I connected with sqlcmd using the -E and then I created a Database
>called
>people, and made a table called person. Still problems inserting from the
>program
>and doing a select. So I removed the User ID=sa;PASSWORD=mypassword
>from the connection string, couldn't connect, then when I put it back I
>still
>couldn't connect, getting the same error. I can't figure out what is
>slightly different
>in the connection string.
>
>The connection string currently is
>
>string conStr = @"Data Source=.\SQLEXPRESS;" +
>"User ID=sa;PASSWORD=mypassword;" +
>"Database=people;" +
>"Integrated Security=True";
>
>The error is
>
>Cannot open database \"people\" requested by the login. The login failed.
>Login
>failed for user 'MDG-13E0564D3NC\\MDG User'.
>
>Also still get the same error using the -U option in sqlcmd.
>
>Do I need to make a login for 'MDG-13E0564D3NC\\MDG User'?
>How do I get sa associated with SQLEXPRESS?
>Searched in google and found advanced stuff that doesn't help
>
>Thanks,
>Ralph
>
>

.



Relevant Pages

  • Re: EXEC master..xp_cmdshell Prevention
    ... > I found that my web application did use a connection string in a file ... > stored procedures for every SQL statement would be impractical. ... I have created a new login account ...
    (microsoft.public.sqlserver.security)
  • Cannot connect using sa
    ... I downloaded C# 2005 Express and downloaded sql 2005 Express at the same ... not if I use sqlcmd -S localhost\SQLEXPRESS -U and type in the password. ... Login failed for user 'sa'. ... from the connection string, couldn't connect, then when I put it back I ...
    (microsoft.public.sqlserver.setup)
  • Re: Can no longer connect as sa
    ... Is there a reason you need to connect using SQL authentication? ... > Login failed for user 'sa'. ... > I can't figure out what is slightly different in the connection string. ...
    (microsoft.public.sqlserver.setup)
  • Re: EXEC master..xp_cmdshell Prevention
    ... stored procedures for every SQL statement would be impractical. ... I have created a new login account ... > sounds as though either a) your connection string isn't what you think it ...
    (microsoft.public.sqlserver.security)
  • Re: EXEC master..xp_cmdshell Prevention
    ... I take it you're using string concatenation to build your sql statements. ... Next item -- using dbo for a web application's login is dangerous, ... sounds as though either a) your connection string isn't what you think it is ...
    (microsoft.public.sqlserver.security)