Classic ASP connection to SQL Server 2005 using Windows Integrated

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)




3 thoughts on “Classic ASP connection to SQL Server 2005 using Windows Integrated”

  1. 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.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: