Link to home
Start Free TrialLog in
Avatar of seakay
seakay

asked on

sql server connection not getting established in asp on localhost

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

ASKER CERTIFIED SOLUTION
Avatar of bluV11t
bluV11t
Flag of Norway image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of seakay
seakay

ASKER

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
Avatar of seakay

ASKER

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
Hi! If you use dsn you dont need provider. Try just cn.connectionstring = "dsn=test;"
Avatar of seakay

ASKER

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
Did you set it up as a system DSN? Is it named "test"?
Avatar of seakay

ASKER

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
Avatar of seakay

ASKER

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