Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeUsing DNN Platf...Using DNN Platf...Administration ...Administration ...Connecting to a restored production DB on local hostConnecting to a restored production DB on local host
Previous
 
Next
New Post
6/2/2010 10:02 PM
 
I'm hoping someone can help me with this hair puller...  I have successfully installed DNN on my laptop running windows 7 pro and SQL Express 2008.  I then set up another local site and downloaded my live DNN site in order to test some planned changes.  Whatever I have tried, I cannot connect to the database when browsing the local host site - I get the error: Upgrade Error: ERROR: Could not connect to database specified in connectionString for SqlDataProvider.  Here is what I have done: 

I restored the database to the app_data folder in the root of the site and configured the connection in web confog as follows:

<add name="SiteSqlServer" connectionString="Data Source=.\SQLExpress;AttachDbFilename=|DataDirectory|nfbc_new.mdf;Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient" />

<add key="SiteSqlServer" value="Data Source=.\SQLExpress;AttachDbFilename=|DataDirectory|nfbc_new.mdf;Integrated Security=True;User Instance=True" />

I attached the database and changed the portal alias table to point to local host.

I set up a seperate app pool for the site.

After this did not work, I deleted the db, restored it again directly in SSMS, updated the portal alias table and changed web confid as follows:

<add name="SiteSqlServer" connectionString="Server=BRIANS-LAPTOP\SQLEXPRESS;Database=db name;uid=****;pwd=****;" providerName="System.Data.SqlClient" />

value="Server=BRIANS-LAPTOP\SQLEXPRESS;Database=db name;uid=****;pwd=****;"/>
 
I Googled the problem and followed the advice I found including in this forum, but to no avail. 

In both cases I compared file access permissions between the working DNN site and the non working site and made changes where needed.  I also looked at db users and access, and compared access, but this is where I think my problem lies.  I don't quite understand how the working site successfully connects to it's db, so it is difficult to figure out.  I'm about to chuck the whole thing and install SQL server 2005, but I really don't want it on my laptop.  Any help with this would be greatly appreciated. 


 

 
New Post
6/2/2010 11:06 PM
 
Make sure under the database > users that your user account is present.
On windows 7 it should be .\SQLExpress

On your production I assume its highly unlikely that you are connecting with Integrated Security, but you very well could be.
On your local you don't have to.

Example of a local site I have connecting to an SQLExpress from a 2008 db.

<add name="SiteSqlServer" connectionString="Data Source=.\SQLEXPRESS; initial catalog=dbname; user ID=****; password=****;" providerName="System.Data.SqlClient" />
<!-- Connection String for SQL Server 2005 Express - kept for backwards compatability - legacy modules -->
    <add key="SiteSqlServer" value="Data Source=.\SQLEXPRESS; initial catalog=dbname; user ID=****; password=*****;" />


always with a restore you'll lose the user assigned to that database.

Now on my machine at work, I don't have sqlexpress.
so I have the datasource=(local) and I do Intergrated Security.  Try that way as well.
 
New Post
6/3/2010 12:44 PM
 
Thanks for the reply, Chatters...

I don't remember a database user called .\SQLExpress on the working site, but I will recheck. but if the user is .\SQLExpress, what is the user in your example below?

Where is your database located on your local host - in the APP_Data folder with it attached in management studio, or do you restore it directly to SQL express?

The production site is using SQL Server 2005, and my user si still present after restore - perhaps I need to check the schema permissions.
 
New Post
6/3/2010 3:10 PM
 
sorry think I may have come off confusing.

if you are running SQL Express, your  connectionString DataSource would be ".\SQLEXPRESS."
You can assign a user to this database, or use Integrated Security ("windows authentication").
  1. I normally would get a backup (.bak) file from my production server.
  2. I would restore that database from the .bak to my SQL Express (local).
  3. Create the user based on the username / password for the user on production (I make them match.) You should get the users info from the web.config. So if it the username / password on live is username:bob , password : password1234. I create a user in my SQLExpress with the same info and assign that user to the newly restored database.

My database base locally, I open up management studio and do a Restore.  When you connect to your database through management studio you'll see ".\SQLEXPRESS" or local depending on if you have express installed or standard SQL.



so to rework my example of the web.config, lets assume my database is named bob_db, and I have a user with the name of bob and I am connecting to a SQLExpress install on my system.

<add name="SiteSqlServer" connectionString="Data Source=.\SQLEXPRESS; initial catalog=bob_db; user ID=bob; password=password1234;" providerName="System.Data.SqlClient" />
<!-- Connection String for SQL Server 2005 Express - kept for backwards compatability - legacy modules -->
    <add key="SiteSqlServer" value="Data Source=.\SQLEXPRESS; initial catalog=bob_db; user ID=bob; password=password1234;" />
 
New Post
6/7/2010 9:42 PM
 
Again, thanks for your help - but I have been trying since you posted to get this working, and it is simply ridiculous...  Dealing with windows7 admin access issues on top of a confusing SQL Express management interface.  I just cannot get it to work, although I just reinstalled the latest DNN source and got a site running in 5 minutes.

I'm running sql express 2008.  When I open it the server name is BRIANS-LAPTOP\SQLEXPRESS.  Is this what I use in the connection string?  You stated .\SQLEXPRESS.

Upon restoring my database, the production user is still present, but I'm not sure if it's permissions are intact.

I may be installing SQL server 2005 real soon and chucking express.  This is really irritating...  Thanks for letting me rant 
 
Previous
 
Next
HomeHomeUsing DNN Platf...Using DNN Platf...Administration ...Administration ...Connecting to a restored production DB on local hostConnecting to a restored production DB on local host


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out