If the two websites are on the same server with the same ip address then it may work. If they are on separate servers with different ip addresses then there is the issue of remote access of a database on one server from a domain on another. That isn't allowed in most cases. Only your hosting company can give you those permissions.

In any case the reason you are doing this is flawed. Search Engines such as Google mark you down heavily, or even blacklist you completely, for duplicate site content on different domains. Best to drop the idea.

Vger