unable to connect to sql db

S

Steve

I moved my database from one server to another SQL server. I did a backup and restore of the database. I can connect to the database on server A from my asp.net app but when I try to connect to my database server B, I'm gettting 'login failed for user 'username'

I've added the username to the database on server B, I can open up SMS and connect to the database that way, but I can't connect from my asp.net web app.

any suggestions on what may be causing me not to be able to connect to my sql server B database?
 
C

ciccone1978

I moved my database from one server to another SQL server. I did a backup and restore of the database. I can connect to the database on server A from my asp.net app but when I try to connect to my database server B, I'm gettting 'login failed for user 'username'

I've added the username to the database on server B, I can open up SMS and connect to the database that way, but I can't connect from my asp.net web app.

any suggestions on what may be causing me not to be able to connect to my sql server B database?

Hi,
have you checked the connection string in the 'web.config' file?
Try to check if all parameters in the connection string are correct
for the srv B database.

Bye
 
S

Steve

Yes, I've checked it several times and still unable to connect to it.

I'm lost on it now.
 
C

ciccone1978

Yes, I've checked it several times and still unable to connect to it.

I'm lost on it now.

If you can, you should provide more informations so maybe I can be
more helpful.
What about error message?
Could you post some asp code?
 
S

Steve

The error i'm getting is

'login failed for user 'username'

I have this as my connection string

<add key="dbConnection"
value="Server=DBServerTest;Database=SalesForTheYear;User
ID=username;Password=password;Trusted_Connection=False;"/>


now, this same connection string works on DBServerDev fine with the same ID
and pwd
 
M

Mark Rae [MVP]

The error i'm getting is

'login failed for user 'username'

I have this as my connection string

<add key="dbConnection"
value="Server=DBServerTest;Database=SalesForTheYear;User
ID=username;Password=password;Trusted_Connection=False;"/>

now, this same connection string works on DBServerDev fine with the same
ID and pwd

You've actually created a SQL login called 'username' and given it a
password of 'password'...?

On the assumption that you have, does that login exist on the DBServerTest
box and, if so, does it have the necessary permissions to access the
SalesForTheYear database...?
 
S

Steve

well, I'm not going to show my actualy Id and pwd, but yeah I have the id
and password on my sql server, and I gave it dbowner permission for the
database I need to access with the id and pwd and no luck
 
M

Mark Rae [MVP]

well, I'm not going to show my actualy Id and pwd, but yeah I have the id
and password on my sql server, and I gave it dbowner permission for the
database I need to access with the id and pwd and no luck

OK - what happens if you open a SQL query in SQL Management Studio and use
those credentials...?

What do you see when you do a SQL trace...?
 
S

Steve

I can't connect using any credentails, but if I log into the server with the
username and password, I can then open the SQL database via sms.

and the security is set for mixed mode.
 
S

Steve

I just ran a trace and I don't see the connection even trying to happen, but
I get the 'login failed for username' message.
 
M

Mark Rae [MVP]

I just ran a trace and I don't see the connection even trying to happen,
but I get the 'login failed for username' message.

In which case, you're either looking at the wrong database or your trace
filter is too restrictive.

If you create a new trace with no filter, and still see nothing, then the
server / database you're running the trace on isn't the same one as your web
app is trying to connect to...
 
M

Mike

I can't even log into the database using the credentials I'm trying to use
for my asp.net app

so i go to SQL Server Management Studio, use SQL Auth, enter in my ID and
PWD, and I get 'login failed for username'.

BUT if I log into the actual server with 'username' and 'pwd' I can then
open up SQL Server Management Studio and access the database with no
problem.
 
M

Mike

but if the ID is under the security tab on the SQL server, what would cause
me not to connect?
 
M

Mark Rae [MVP]

but if the ID is under the security tab on the SQL server, what would
cause me not to connect?

Difficult to say without seeing your SQL Server, but that's definitely where
the problem lies - nothing to do with ASP.NET per se...

Is the login in question mapped to a user in the database in question...?
 
M

Mike

yes, the ID is mapped to the database. The thing is I can only get the DB
working on the server it was setup on. If I backup and restore the db to
another server no ID works with it.

so i have to do some researching on this I guess
 
M

Mike

I found the issue.
The developer that setup the db on the dev server is using SQL Auth, but
with an windows ID.
so instead of using domain\username using windows auth (like it should be)
he's using sql auth.

So how can I setup the DB to use windows auth but using the
domain\username;password, that i'm specifing?
 

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

Forum statistics

Threads
473,967
Messages
2,570,148
Members
46,694
Latest member
LetaCadwal

Latest Threads

Top