?
Solved

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

Posted on 2006-06-19
13
Medium Priority
?
2,250 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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 150 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 225 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
I have a large data set and a SSIS package. How can I load this file in multi threading?
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.

719 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