Solved

sql server connection not getting established in asp on localhost

Posted on 2008-10-18
9
493 Views
Last Modified: 2008-10-18
Hi
I was trying to create an asp applicaiton on my windows xp professional with sql server installed with windows authentication. The system name is SYSTEMP.

When I ran the asp page with the attached code snippet, I am getting the error message "Microsoft OLE DB Provider for SQL Server (0x80004005) Login failed for user 'sa'. Reason: Not associated with a trusted SQL Server connection."

 Please tell me what is wrong with the connection string and how it should be corrected.
thanks
Kay
Dim cn 
Set cn = Server.Createobject("ADODB.Connection")
cn.connectionstring  = "Provider=SQLOLEDB; Data Source=SYSTEMP ; Initial Catalog=example; UID=sa; Password=;"
cn.open

Open in new window

0
Comment
Question by:seakay
[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
9 Comments
 
LVL 7

Accepted Solution

by:
bluV11t earned 50 total points
ID: 22748319
Hi!
Check out http://www.connectionstrings.com/?carrier=sqlserver

I always prefer setting up a DSN connection in ODBC manager (Control Panel/Administrative tools/Data Sources (ODBC)) with username and password and test the connection there. If you do this the cn.connectionstring = "DSN=yourDSNname;"
0
 
LVL 7

Assisted Solution

by:bluV11t
bluV11t earned 50 total points
ID: 22748372
The connectionstring in it self is not wrong but with windows authentication on the server you need somthing different. Here is a similar question:
http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/ASP/Q_22802136.html
0
 

Author Comment

by:seakay
ID: 22748383
Thanks bluV11t for your reply.
I tried out your suggestion and created a dsn named test
Then i gave the following connection string

 cn.connectionstring  = "Provider=SQLOLEDB;   dsn=test"
But now it gives the errow message
Microsoft OLE DB Provider for SQL Server (0x80004005) Invalid connection string attribute

Please advise
Thanks
Kay
0
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

 

Author Comment

by:seakay
ID: 22748504
Thanks bluV11t for your reply.
I tried out differnt strings as suggested in your link.
Later I tried changing the windows authentication to windows and sql server authentication
and gave the connection string as :
Provider=SQLOLEDB;   Data Source=SYSTEMP; Intial Catalog=example; uid=sa;Password=

I had tried earlier with windows login user id and password

The error message is still
Microsoft OLE DB Provider for SQL Server (0x80004005)
Invalid connection string attribute.

Any other suggestions? Please advise

Thanks
Kay
0
 
LVL 7

Expert Comment

by:bluV11t
ID: 22748570
Hi! If you use dsn you dont need provider. Try just cn.connectionstring = "dsn=test;"
0
 

Author Comment

by:seakay
ID: 22748891
Hi
Thanks bluV11t for your reply.
Tried cn.connectionstring = "dsn=test;"
but got
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

But when I tested the connection, it said that it was a success.
What am I doing wrong? Please help
Thanks
Kay
0
 
LVL 7

Expert Comment

by:bluV11t
ID: 22748987
Did you set it up as a system DSN? Is it named "test"?
0
 

Author Comment

by:seakay
ID: 22750065
HI
Thanks bluV11t for your reply.
Yes I had set up an ODBC connection to the required database with the name test tried with both windows authentication and sql server authentication. The result was the same

Should I change some settings in the SQL server side? or elsewhere?
Thanks for your replies so far. Please help
Thank you
Kay
0
 

Author Comment

by:seakay
ID: 22750379
Hi
Thank you for your help
The following connections string worked for me.
 "Provider=SQLOLEDB; Data Source=(local) ; Initial Catalog=example;Persist Security Info=False;uid=sa;Password=;"

The follwoing link helped:
http://www.carlprothman.net/Default.aspx?tabid=87#OLEDBProviderForSQLServer

Thanks
Kay
0

Featured Post

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

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

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.
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

628 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