Connection to SQL Server

K

Keith Norris

I am having a problem connecting to my SQL Server with the following ASP
code:

set cn = server.createobject("adodb.connection")
cn.connectionstring = "Provider=sqloledb; data source=midatlanticus;
Integrated Security=SSPI"
cn.open

But, if I use the same connection string in a VB program, I connect
successfully. The VB code that works successfully is as follows:

Dim cn As ADODB.Connection

Set cn = New ADODB.Connection
cn.ConnectionString = "provider=sqloledb; data source=midatlanticus;
Integrated Security=SSPI"
cn.Open

Please tell me why this connection string will work successfully in VB but
not ASP/VBScript. What am I doing wrong with the ASP version? What do I do
to get a successful connection in the ASP/VBScript version?

Thank you very much!
Keith
 
C

Curt_C [MVP]

ASP is running under a different user context.
Turn off anonymous or put a username/pass in the conn string
 
K

Keith Norris

I have tried the connection string with a username and password without
success. For example,

cn.ConnectionString = "Provider=sqloledb; data source=midatlanticus;
Integrated Security=SSPI; user id=keith;password=doodado"

assuming doodado is my valid password. This does not work. The server is
on a domain controller and the name of the domain is DOMAIN. I also tried
the following:

cn.ConnectionString = "Provider=sqloledb; data source=midatlanticus;
Integrated Security=SSPI; user id=DOMAIN/keith;password=doodado"

This still did not work. I'm still missing something. Any ideas?

Thanks,
Keith
 
T

Tom B

If you are passing a user id and password, remove the integrated
security=SSPI. Also, in SQL Server Enterprise manager, right click your
server name (midatlanticus) and select properties, then on the security tab
select SQL Server and Windows Authentication.
 
T

Tom B

Oh, yeah. Then you need to create a login for Keith with a password of
doodado.

Your other option is to continue to use Windows Authentication only, but
change the account that IIS runs under.
 
K

Keith Norris

Thank you! I needed to right click the particular web site in Internet
Information Services and click properties and then uncheck the allow
anonymous access check box.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,091
Messages
2,570,605
Members
47,225
Latest member
DarrinWhit

Latest Threads

Top