[Last Call] Learn how to a build a cloud-first strategyRegister Now


ADODB integrated authenticantion instead of username and password authenticantion

Posted on 2008-11-12
Medium Priority
Last Modified: 2012-05-05
Hallo Expert,

I am relatively new in ASP and need to switch from username+password ADODB authentication to integrated authentication ADODB.

My database is MSSQL 2005

My username+password ADODB authentication looks like this. And it is included in all my ASP sites.
Can someone please tell me how to change the code so it works with authentication to integrated authentication ADODB?

And do I have to change other parts in my code as well or only this part?  



Set CS = Server.CreateObject("ADODB.Connection")
CS.Open "DSN=MyDNS;Uid=MyUsername;Pwd=MyPassword"
query = "SELECT * FROM tablename"
Set RS = Server.CreateObject("ADODB.Recordset")
RS.Open query, CS

Open in new window

Question by:Steynsk
LVL 143

Accepted Solution

Guy Hengel [angelIII / a3] earned 2000 total points
ID: 22939657
the connection string would be like this:

CS.Open "Provider=SqlOledb;Server=yoursqlsevername_or_ip;Integrated Security=SSPI;"

however, to use the end-user's windows account, only possible on intranet solutions (otherwise the asp startup account will be used...), you need to configure the iis web site to disable anonymeous access.

Expert Comment

ID: 22944976
You could grant windows account running IIS service access to SQL Server.
If SQL Server is located on remote machine you will need to configure IIS site service account to run under domain account. Here is one more example of connection string:
"Provider=SQLOLEDB;Integrated Security=SSPI;Initial Catalog=pubs;Data Source=."

Author Closing Comment

ID: 31515936

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
An alternative to the "For XML" way of pivoting and concatenating result sets into strings, and an easy introduction to "common table expressions" (CTEs). Being someone who is always looking for alternatives to "work your data", I came across this …
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…
Suggested Courses

831 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