Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2006-06-19
13
Medium Priority
?
2,257 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

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

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

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

In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
When trying to connect from SSMS v17.x to a SQL Server Integration Services 2016 instance or previous version, you get the error “Connecting to the Integration Services service on the computer failed with the following error: 'The specified service …
Viewers will learn how the fundamental information of how to create a table.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

879 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