Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

sql server connection not getting established in asp on localhost

Posted on 2008-10-18
9
Medium Priority
?
494 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 200 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 200 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
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 

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

What Is Blockchain Technology?

Blockchain is a technology that underpins the success of Bitcoin and other digital currencies, but it has uses far beyond finance. Learn how blockchain works and why it is proving disruptive to other areas of IT.

Question has a verified solution.

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

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The viewer will learn the basics of jQuery including how to code hide show and toggles. 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…
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…

705 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