By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,647 Members | 1,588 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,647 IT Pros & Developers. It's quick & easy.

unable to connect to sql db

P: n/a
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?

Aug 28 '07 #1
Share this Question
Share on Google+
21 Replies


P: n/a
On Aug 28, 2:47 pm, "Steve" <St...@community.nospam.comwrote:
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

Aug 28 '07 #2

P: n/a
Yes, I've checked it several times and still unable to connect to it.

I'm lost on it now.
<ci*********@gmail.comwrote in message
news:11**********************@r29g2000hsg.googlegr oups.com...
On Aug 28, 2:47 pm, "Steve" <St...@community.nospam.comwrote:
>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

Aug 28 '07 #3

P: n/a
On Aug 28, 4:57 pm, "Steve" <St...@community.nospam.comwrote:
Yes, I've checked it several times and still unable to connect to it.

I'm lost on it now.

<ciccone1...@gmail.comwrote in message

news:11**********************@r29g2000hsg.googlegr oups.com...
On Aug 28, 2:47 pm, "Steve" <St...@community.nospam.comwrote:
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
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?

Aug 28 '07 #4

P: n/a
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=SalesForTheYea r;User
ID=username;Password=password;Trusted_Connection=F alse;"/>
now, this same connection string works on DBServerDev fine with the same ID
and pwd
<ci*********@gmail.comwrote in message
news:11********************@19g2000hsx.googlegroup s.com...
On Aug 28, 4:57 pm, "Steve" <St...@community.nospam.comwrote:
>Yes, I've checked it several times and still unable to connect to it.

I'm lost on it now.

<ciccone1...@gmail.comwrote in message

news:11**********************@r29g2000hsg.googleg roups.com...
On Aug 28, 2:47 pm, "Steve" <St...@community.nospam.comwrote:
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

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?

Aug 28 '07 #5

P: n/a
"Steve" <St***@community.nospam.comwrote in message
news:ez**************@TK2MSFTNGP04.phx.gbl...
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=SalesForTheYea r;User
ID=username;Password=password;Trusted_Connection=F alse;"/>

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...?
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Aug 28 '07 #6

P: n/a
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

"Mark Rae [MVP]" <ma**@markNOSPAMrae.netwrote in message
news:%2******************@TK2MSFTNGP06.phx.gbl...
"Steve" <St***@community.nospam.comwrote in message
news:ez**************@TK2MSFTNGP04.phx.gbl...
>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=SalesForTheYe ar;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...?
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Aug 28 '07 #7

P: n/a
"Steve" <St***@community.nospam.comwrote in message
news:us**************@TK2MSFTNGP06.phx.gbl...
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...?
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Aug 28 '07 #8

P: n/a
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.

"Mark Rae [MVP]" <ma**@markNOSPAMrae.netwrote in message
news:eg**************@TK2MSFTNGP04.phx.gbl...
"Steve" <St***@community.nospam.comwrote in message
news:us**************@TK2MSFTNGP06.phx.gbl...
>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...?
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Aug 28 '07 #9

P: n/a
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.
"Mark Rae [MVP]" <ma**@markNOSPAMrae.netwrote in message
news:eg**************@TK2MSFTNGP04.phx.gbl...
"Steve" <St***@community.nospam.comwrote in message
news:us**************@TK2MSFTNGP06.phx.gbl...
>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...?
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Aug 28 '07 #10

P: n/a
"Steve" <St***@community.nospam.comwrote in message
news:OK**************@TK2MSFTNGP05.phx.gbl...
>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...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Aug 28 '07 #11

P: n/a
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.

"Mark Rae [MVP]" <ma**@markNOSPAMrae.netwrote in message
news:e3**************@TK2MSFTNGP03.phx.gbl...
"Steve" <St***@community.nospam.comwrote in message
news:OK**************@TK2MSFTNGP05.phx.gbl...
>>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...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Aug 28 '07 #12

P: n/a
"Mike" <Mi**@community.nospam.comwrote in message
news:%2******************@TK2MSFTNGP02.phx.gbl...
>I can't even log into the database using the credentials I'm trying to use
for my asp.net app
That would appear to be the problem, then...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Aug 28 '07 #13

P: n/a
but if the ID is under the security tab on the SQL server, what would cause
me not to connect?
"Mark Rae [MVP]" <ma**@markNOSPAMrae.netwrote in message
news:OW**************@TK2MSFTNGP04.phx.gbl...
"Mike" <Mi**@community.nospam.comwrote in message
news:%2******************@TK2MSFTNGP02.phx.gbl...
>>I can't even log into the database using the credentials I'm trying to use
for my asp.net app

That would appear to be the problem, then...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Aug 28 '07 #14

P: n/a
"Mike" <Mi**@community.nospam.comwrote in message
news:eG**************@TK2MSFTNGP02.phx.gbl...
>>>I can't even log into the database using the credentials I'm trying to
use for my asp.net app

That would appear to be the problem, then...

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...?
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Aug 28 '07 #15

P: n/a
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

"Mark Rae [MVP]" <ma**@markNOSPAMrae.netwrote in message
news:eR**************@TK2MSFTNGP03.phx.gbl...
"Mike" <Mi**@community.nospam.comwrote in message
news:eG**************@TK2MSFTNGP02.phx.gbl...
>>>>I can't even log into the database using the credentials I'm trying to
use for my asp.net app

That would appear to be the problem, then...

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...?
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Aug 28 '07 #16

P: n/a
"Mike" <Mi**@community.nospam.comwrote in message
news:u9**************@TK2MSFTNGP02.phx.gbl...
>>>>>I can't even log into the database using the credentials I'm trying to
>use for my asp.net app

That would appear to be the problem, then...

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

so i have to do some researching on this I guess
You might get a better response in one of the microsoft.public.sqlserver.*
groups...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Aug 28 '07 #17

P: n/a
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?
"Mark Rae [MVP]" <ma**@markNOSPAMrae.netwrote in message
news:eR**************@TK2MSFTNGP03.phx.gbl...
"Mike" <Mi**@community.nospam.comwrote in message
news:eG**************@TK2MSFTNGP02.phx.gbl...
>>>>I can't even log into the database using the credentials I'm trying to
use for my asp.net app

That would appear to be the problem, then...

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...?
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Aug 28 '07 #18

P: n/a
"Mike" <Mi**@community.nospam.comwrote in message
news:O8**************@TK2MSFTNGP05.phx.gbl...
So how can I setup the DB to use windows auth but using the
domain\username;password, that i'm specifing?
Mixed mode / integrated security:
http://www.google.co.uk/search?sourc...authentication
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Aug 28 '07 #19

P: n/a
I have it setup as that, but still no luck.
"Mark Rae [MVP]" <ma**@markNOSPAMrae.netwrote in message
news:eN**************@TK2MSFTNGP06.phx.gbl...
"Mike" <Mi**@community.nospam.comwrote in message
news:O8**************@TK2MSFTNGP05.phx.gbl...
>So how can I setup the DB to use windows auth but using the
domain\username;password, that i'm specifing?

Mixed mode / integrated security:
http://www.google.co.uk/search?sourc...authentication
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Aug 29 '07 #20

P: n/a
On Aug 28, 9:59 pm, "Mike" <M...@community.nospam.comwrote:
So how can I setup the DB to use windows auth but using the
domain\username;password, that i'm specifing?
In this case you should use impersonation in your web application.

Aug 29 '07 #21

P: n/a
I did that to and I got 'login not assocaited with a trusted connection'

"Alexey Smirnov" <al************@gmail.comwrote in message
news:11**********************@19g2000hsx.googlegro ups.com...
On Aug 28, 9:59 pm, "Mike" <M...@community.nospam.comwrote:
>So how can I setup the DB to use windows auth but using the
domain\username;password, that i'm specifing?

In this case you should use impersonation in your web application.

Aug 29 '07 #22

This discussion thread is closed

Replies have been disabled for this discussion.