Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Cannot open database requested in login

Author  Topic 

stormseeker75
Starting Member

3 Posts

Posted - 2010-01-09 : 14:49:51
I'm getting this message when my program tries to connect to the SQL server. I have all my System DSN's setup properly as they can connect with no problem in the ODBC. However, when my program tries to open the database, it errors out.

I have created a backup SQL server and this is where we are getting this issue. However, my program will connect to the main SQL server with no problem. We exported the databases from the original SQL box and imported then on the backup box. I did notice that there was no login associated with dbo on this particular database so I used the sp_changedbowner command and now the correct login is associated with dbo. Prior to that change, my program wouldn't even find the database, so now at least it sees it even though it can't connect.

This is my first time working with SQL and I have some good helpers, but its all new to me.

Thank you in advance for any help which is offered.

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-01-09 : 15:04:43
Do you create the login on the backup server? Did you unorphan the account?

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog

"Let's begin with the premise that everything you've done up until this point is wrong."
Go to Top of Page

stormseeker75
Starting Member

3 Posts

Posted - 2010-01-11 : 09:14:59
Tara, thanks for responding. As for "unorphaning", I'm not quite sure what you mean. I will look it up and see if I can figure it out. Since I don't know what that means, lets assume that I did not do that.
Go to Top of Page

jackv
Master Smack Fu Yak Hacker

2179 Posts

Posted - 2010-01-11 : 09:25:18
1)Does a logon exist on backup sql server?
2)Is it mapped to an appropriate user account on relevant database - properly configured - and acccess to it's default db?
3)If the above are OK - try : EXEC sp_change_users_login 'UPDATE_ONE','<user>','<login>'. This will unorphan

Jack Vamvas
--------------------
http://www.ITjobfeed.com
Go to Top of Page

stormseeker75
Starting Member

3 Posts

Posted - 2010-01-11 : 09:29:48
quote:
Originally posted by jackv

1)Does a logon exist on backup sql server?
2)Is it mapped to an appropriate user account on relevant database - properly configured - and acccess to it's default db?
3)If the above are OK - try : EXEC sp_change_users_login 'UPDATE_ONE','<user>','<login>'. This will unorphan



Thanks Jack, I'll give it a go. I have 2 users for that database right now. One is dbo which has a login name and the other is slogin which also has a login name.
Go to Top of Page
   

- Advertisement -