Classic ASP connection to SQL Server 2005 using Windows Integrated

Tags: Classic ASP, ASP

I had a forums question posted about someone wanting to use Classic ASP and a windows user.  All you have to do is run your application pool as network service (not recommended) or a custom user (local or domain).  Then make sure the Windows user has rights on the database.  If the database is remote, use a domain account.  If IIS and SQL are on the same box, you could get away with a local account.


dim conn
dim rs

strConn = “Driver={SQL Server};Server=Server1;Database=Authors;Trusted_Connection=Yes;”
Set cnt = Server.CreateObject(“ADODB.Connection”)
cnt.ConnectionString= strConn

strSQL = “select * from names”
set rs = cnt.execute(strSQL)

Do while not rs.eof

 response.write “Name:” & rs(0)





  • http:// said

    As far as security goes, how does using Windows Integrated compare to something like this?

    conn.ConnectionString = "DSN.DatabaseName"
    conn.Open "DSN=DatabaseName;uid=sa;password=;"

    The DSN makes it much easier to write out a connection string, but it's potentially exposing database login credentials, as far as I can tell.

  • steve schofield said

    You won't have to expose a password with Windows Integrated. If you are going to have a username / password. Encrypt your connection string.

Add a Comment