Solved

Login failed for user 'sa'. Reason: Not associated with a trusted SQL Server Connection

Posted on 2006-06-19
13
2,226 Views
Last Modified: 2008-02-26
I am using Windows XP Professional and have installed MSDE 2000. I have searched the information on the Experts Exchange site and cannot find a solution as it applies to Windows XP. The connection object is set as follows:

Dim objConn
Set objConn = Server.CreateObject("ADODB.Connection")

objConn.Open "Provider=SQLOLEDB;Persist Security Info=False;" & _
                     "User ID=sa; Initial Catalog=Movie;" & _
                     "Initial File Name=C:\MSSQL7\Data\Movie2000.mdf"

In prior discussions on Experts Exchange, there is mention of Windows security settings and security settings for the SQL Server. I don't know how to access those to make changes.
0
Comment
Question by:jbotts
  • 5
  • 4
  • 2
  • +2
13 Comments
 
LVL 29

Expert Comment

by:QPR
ID: 16939302
Hi jbotts,
have a read here
http://support.microsoft.com/kb/889615/en-us
0
 

Author Comment

by:jbotts
ID: 16939367
Thanks QPR
I have read the suggested material and there is a suggestion to go into "Enterprise Manager" which is either not part of Windows XP Professional or I don't know how to access it. The only other solution is to make changes in the registry through the registry editor. I don't know the command line for to run the registry editor.
Thanks,
jbotts
0
 
LVL 29

Expert Comment

by:QPR
ID: 16939409
Ahhh do you have a SQL Server disc?
What you need is "client tools for SQL server" installed on your workstation.
This will allow you to admin the MSDE installation.... create users, make tables etc.

Some development programs have the ability to connect to SQL/MSDE and show you the contents.
WebMatrix is an (free from www.asp.net) program that springs to mind.
0
Free Webinar: AWS Backup & DR

Join our upcoming webinar with experts from AWS, CloudBerry Lab, and the Town of Edgartown IT to discuss best practices for simplifying online backup management and cutting costs.

 

Expert Comment

by:bshah4u
ID: 16939435
Are you trying with MSSQL 7 ot MSSQL 2000?? as your File path suggests MSSQL 7??
0
 
LVL 28

Expert Comment

by:imran_fast
ID: 16940075
should include pwd parameter in your connection string.

objConn.Open "Provider=SQLOLEDB;Persist Security Info=False;" & _
                     "User ID=sa; Pwd= sapassword Initial Catalog=Movie;" & _
                     "Initial File Name=C:\MSSQL7\Data\Movie2000.mdf"
0
 
LVL 8

Assisted Solution

by:wraith821
wraith821 earned 50 total points
ID: 16941421
MSDE installs with only windows authentication enabled. Not Mixed SQL and NT Authentication.

First you have to edit the registry and enable Mixed Authentication
1. Stop the MSSQLSERVER Service
2. Edit the key or confirm that its value is 2 [HKLM\SOFTWARE\Microsoft\MSSQLServer\MSSQLServer - LoginMode = 2]
3. Restart the MSSQLSERVER Service.
4. With vb or vbscript. Make a trusted connection. Then run the following Stored Procedure

sp_password null, 'password', 'sa'

once Mixed Authentication is enable you may be able to connect with sa and no password (bypass step 4). you'll just have to test that. I've always set mine.

0
 

Author Comment

by:jbotts
ID: 16947654
I have done the following:

1. Changed the registry to enable Mixed Authentication
       HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSSQLServer\MSSQLServer - LoginMode = 2
2. Code for the connection has changed to:
       objConn.Open "Provider=SQLOLEDB;Persist Security Info=False;" & _
                            "User ID=sa; Pwd= sapassword Initial Catalog=Movie;" & _
                            "Initial File Name=C:\MSSQL7\Data\Movie2000.mdf"

The connection still does not work. The message is:
       Login failed for user 'sa'.
0
 
LVL 29

Expert Comment

by:QPR
ID: 16947666
and the password you are using in your conn string is definately the SA's password (case sensitive)?
0
 

Author Comment

by:jbotts
ID: 16947757
I am new at this. I just installed the MSSQL Server (MSDE 2000). I am not sure what the user name or passwords are. How may I find out?
0
 
LVL 29

Expert Comment

by:QPR
ID: 16947769
SA username is always SA.
MS SQL propmts you for a SA password when you install SP3 or higher (if none exists).
I'm not sure about MSDE

Try not passing a password at all e.g. User ID=sa; Pwd=
Also, should there be a semi colon (;) betwen the logon credentials and the initial catalog?
0
 

Author Comment

by:jbotts
ID: 16947854
QPR,
I made the corrections in the code and got the same message.
0
 
LVL 29

Accepted Solution

by:
QPR earned 75 total points
ID: 16947882
Try setting/reetting the SA password
http://support.microsoft.com/?kbid=322336

Then you can use whatever you set it to which will either fix your fault or elimanate that from the possible reasons.
0
 
LVL 8

Expert Comment

by:wraith821
ID: 16950474
typical... i get a B and an assist because i told you exaclty what the link the accepted answer gave you? again the world makes since
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Conditions in Where clause 9 46
sql update 2 34
Want an individual results display div 8 39
SQL Server Express or Standard? 5 18
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.

679 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question