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

HomeHomeGetting StartedGetting StartedInstalling DNN ...Installing DNN ...Trouble with the |DataDirectory| variableTrouble with the |DataDirectory| variable
Previous
 
Next
New Post
4/27/2007 11:28 AM
 

I have copied a DNN site + database from a windows Server 2003 machine to a windows XP Pro SP2 machine.

The database is not the original database.mdf but a custom db, which I'll allude to as "custom" for the purpose of this post.

"Custom" used to run under SQL Server 2000 on the original server. I have backed it up and restored the bak file to a "custom" db created on my SQL Server Express 2005. I have modified the connectionstrings in web.config accrodingly, commenting out the SQL server syntax and using the SQL Express syntax instead.

I cannot access the database. After looking into rights and ensuring I have set them correctly, I have realised that, on the original server, the database files were not in the default SQL Server directory. Google searches have revealed that the |DataDirectory| variable used in connectionString will keep the value set on the original machine. I have attempted to replace |DataDirectory| with the full explicit db path, but the connectionString value is then too long (over 128chars).

I therefore need to change the value of |DataDirectory| and ensure that it corresponds to my SQL Server Default data directory.

I know I need to call the method AppDomain.SetData("Data directory", <newpath>), but which file should the method be included in?Do I need to override a DNN class?If so, which one?

Many thanks in advance for any help you can lend.

 
New Post
4/27/2007 11:44 AM
 

If you have the DB restored to Express, you can probably connect to it via the 2000/2005 connection string format, that's what I tend to do when I restore to express, I don't use the datadirectory formatted string, I just connect to the SQL express instance, something like machinename/sqlexpress for the server name.


Chris Hammond
Former DNN Corp Employee, MVP, Core Team Member, Trustee
Christoc.com Software Solutions DotNetNuke Module Development, Upgrades and consulting.
dnnCHAT.com a chat room for DotNetNuke discussions
 
New Post
4/27/2007 12:15 PM
 

many thanks for your quick reply Chris.

I tried what you said, but am still unsuccesful.

This is the error I get

Could not connect to database specified in connectionString for SqlDataProvider

 
New Post
4/27/2007 12:20 PM
 

You'll probably have to create a SQL user to connect to the DB as well, you might try connecting to the DB through query analyzer or another tool first so that you can verify you are able to connect to it "remotely" though you aren't remote, most likely on the same machine.


Chris Hammond
Former DNN Corp Employee, MVP, Core Team Member, Trustee
Christoc.com Software Solutions DotNetNuke Module Development, Upgrades and consulting.
dnnCHAT.com a chat room for DotNetNuke discussions
 
New Post
5/3/2007 12:52 PM
 

Many thanks again Chris.

I used this connection string format in web.config...in case it helps other SQL Express users. This elimintes the need for |DataDirectory|

<add name="SiteSqlServer"
           connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=YOURDATABASENAME;Integrated Security=True;uid=YOURUSER;pwd=YOURUSERPASSWORD;"
           providerName="System.Data.SqlClient" />

However, one last thing needs doing....add the ASP.net process account to your machine's administrator group or access to the db will never work. in windows XP the ASP.net process account will be ASPNET, in Server 2003 it will be NETWORK SERVICE.

 
Previous
 
Next
HomeHomeGetting StartedGetting StartedInstalling DNN ...Installing DNN ...Trouble with the |DataDirectory| variableTrouble with the |DataDirectory| variable


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