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
Solved

sql server connection not getting established in asp on localhost

Posted on 2008-10-18
9
491 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
  • 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
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 

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

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
Diminish Pop-up  in 3 seconds 7 47
Underline in nav for the page that you are currently on. 1 22
forgetful about js objects 8 46
Json Schema 8 32
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.
When you start your Windows 10 PC and got an "Operating system not found" error or just saw  "Auto repair for startup" or a blinking cursor with black screen. A loop for Auto repair will start but fix nothing.  You will be panic as there are no back…
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…

856 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