working with a local db copy

working with a local db copy

am 10.01.2008 20:48:50 von ll

Hi,
I have copied a MS SQL database to my local machine and am testing it
with ASP pages, locally, on IIS. I have a db connect page that keeps
the current connections for the live database. My question is, as the
local db is named 'local,' is there another name I need to give it and
thus call from the connection page?
Also, when copying a db, are the permissions (username and pass)
copied over with it?

Thanks,
Louis

Re: working with a local db copy

am 10.01.2008 23:26:37 von Erland Sommarskog

ll (barn104_1999@yahoo.com) writes:
> I have copied a MS SQL database to my local machine and am testing it
> with ASP pages, locally, on IIS. I have a db connect page that keeps
> the current connections for the live database. My question is, as the
> local db is named 'local,' is there another name I need to give it and
> thus call from the connection page?

Since I don't at all how your connection page looks like that is a little
hard to tell. But if the database is called local, your connection
string would look something like:

Provider=SQLNCLI;Server=(local);Database=local;
UserID=xxx;Password=yyy

It seems though, that it would be simpler to have the same name as the
live database (which I assume is on another server). I guess that you
still need to change the Server part, since I assume that in the live
system, IIS runs on a different machine from SQL Server. (Well, it
should do.)

> Also, when copying a db, are the permissions (username and pass)
> copied over with it?

The database as such does not include any logins and password, they
are stored in the master database. The server logins map to users in
your database, and the database users are copied with the database
(since they are part of it). However, if you have login X and user
X on the source system, and also the login X on the local system,
user X will typically not map to login X after the copy, because the
SID are different. This is something you need to clean up after the
copy.

Then aagain, some schemes for copying will permit you to copy logins
as well. But I don't know how you copied the database, so I can't
say whether your logins were copied or not.


--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downlo ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books .mspx