ADODB integrated authenticantion instead of username and password authenticantion

Posted on 2008-11-12
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 142

    Accepted Solution

    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.
    LVL 9

    Expert Comment

    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=."
    LVL 1

    Author Closing Comment


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Find Ransomware Secrets With All-Source Analysis

    Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

    I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
    Nowadays, some of developer are too much worried about data. Who is using data, who is updating it etc. etc. Because, data is more costlier in term of money and information. So security of data is focusing concern in days. Lets' understand the Au…
    Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
    Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.

    761 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

    Need Help in Real-Time?

    Connect with top rated Experts

    7 Experts available now in Live!

    Get 1:1 Help Now