Error using SQL Server Express

G

glbdev

I can't seem to create a connection string to my SQL Server 2005
Express with windows authentication using classic ASP

This is my current string:
sConnStr = "Provider=sqlNCLI;Integrated Security=SSPI;Persist Security
Info=False;Initial Catalog=MyDatabase;Data Source=MYSERVER\SQLEXPRESS"

I got this string from a search but still can't make it work.

Here's the error I get:
Error Type:
Microsoft SQL Native Client (0x80004005)
Cannot open database "MyDatabase" requested by the login. The login
failed.

Thanks,
Gary
 
B

Bob Barrows

I can't seem to create a connection string to my SQL Server 2005
Express with windows authentication using classic ASP

This is my current string:
sConnStr = "Provider=sqlNCLI;Integrated Security=SSPI;Persist Security
Info=False;Initial Catalog=MyDatabase;Data Source=MYSERVER\SQLEXPRESS"

I got this string from a search but still can't make it work.

Here's the error I get:
Error Type:
Microsoft SQL Native Client (0x80004005)
Cannot open database "MyDatabase" requested by the login. The login
failed.
What is the user account that ASP is running under? Have you set up a
login for that account in your SQL Server?
 
G

glbdev

What is the user account that ASP is running under? Have you set up a
login for that account in your SQL Server?

--
HTH,
Bob Barrows- Hide quoted text -

- Show quoted text -

I guess I am confused by this. I am using windows authentication.
Shouldn't that work? If not, what do I need to do?
 
B

Bob Barrows

I guess I am confused by this. I am using windows authentication.
Shouldn't that work? If not, what do I need to do?

Well, you didn't tell us if you were using Anonymous authentication, so
I had to ask. It sounds as if you have Integrated turned on, have you
unchecked Anonymous? If you execute
Response.Write Request.ServerVariables("LOGON_USER")

do you get the expected answer?

Anyways, I have not had any luck using ASP/ADO to connect to SQL 2005
using integrated security for some reason. I have had to resort to using
a SQL Login instead. Maybe i gave up too soon. Has anyone had any luck
doing this?
 
G

glbdev

Well, you didn't tell us if you were using Anonymous authentication, so
I had to ask. It sounds as if you have Integrated turned on, have you
unchecked Anonymous? If you execute
Response.Write Request.ServerVariables("LOGON_USER")

do you get the expected answer?

Anyways, I have not had any luck using ASP/ADO to connect to SQL 2005
using integrated security for some reason. I have had to resort to using
a SQL Login instead. Maybe i gave up too soon. Has anyone had any luck
doing this?

--
HTH,
Bob Barrows- Hide quoted text -

- Show quoted text -


I Changed the connection string to:
Provider=SQLNCLI;Server=MYSERVER
\SQLExpress;Database=MYDATABASE;Trusted_Connection=yes;

But now I get this error:
Error Type:
Provider (0x80040E21)
Multiple-step OLE DB operation generated errors. Check each OLE DB
status value, if available. No work was done.
 
G

glbdev

I Changed the connection string to:
Provider=SQLNCLI;Server=MYSERVER
\SQLExpress;Database=MYDATABASE;Trusted_Connection=yes;

But now I get this error:
Error Type:
Provider (0x80040E21)
Multiple-step OLE DB operation generated errors. Check each OLE DB
status value, if available. No work was done.- Hide quoted text -

- Show quoted text -

BTW: The query I am try to run is just a simple select statement
like: SELECT FirstName FROM employees
 
B

Bob Barrows

I Changed the connection string to:
Provider=SQLNCLI;Server=MYSERVER
\SQLExpress;Database=MYDATABASE;Trusted_Connection=yes;
As expected, that made no difference. Trusted Connection = Integrated
Security.

As I said, the only way I've been able to make it work is by creating a
non-Windows SQL Login in my SQL Server, and using that in my connection
string:
Provider=SQLNCLI;Initial Catalog=MyDatabase;Data
Source=MYSERVER\SQLEXPRESS; user id=sqllogin;password=sqlloginpassword
 

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
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top