IIS
  Home arrow IIS arrow Page 3 - Creating Test and Production Sites with On...
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Silverlight  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
ASP Web Hosting  
ASP.NET Web Hosting 
Windows Web Hosting
 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
IIS

Creating Test and Production Sites with Only One IIS Server
By: Justin Cook
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 50
    2004-04-28

    Table of Contents:
  • Creating Test and Production Sites with Only One IIS Server
  • Overview, Step 1
  • Step 2: It Looks Like the Database, and Smells Like the Database
  • Step 3: Configuring IIS
  • Step 4: Code Control

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Creating Test and Production Sites with Only One IIS Server - Step 2: It Looks Like the Database, and Smells Like the Database


    (Page 3 of 5 )

    Once again, there are two parts to this step. So now you're thinking “hey, if there are two parts to this step, and same with the last, and who knows how many parts for the next steps, it's really not a 4-step process!” Yes, you're right, I apologize. I wasn't trying to trick you! But hey, if it was really only 4 steps, there would probably be no need for a tutorial, right?

    Now that we've gotten that little discrepancy settled, let's discuss the first part: copying the database.

    As I mentioned, I was using MySQL, and MySQL has a wonderful little tool called mysqldump. With this tool, you can easily create a 'dump' of the database, either of the structure only, or even the structure and all content with it. The 'dump' file is a text files filled with SQL commands that would recreate the structure [and optionally the content]. This is normally a .sql file. Once we have the .sql file, we can feed that back into MySQL, into a second – or 'test' – database.

    So here's how I did this. First, I created a second, empty database called dbTest. I then made sure the SQLuser (used in the application) user had the same permissions on this database. Then I opened up my command prompt, and typed the following:

    cd C:mysqlbin (your install dir here)

    mysqldump --quick --user=root --password=******* dbProd > c:bkp.sql

    This creates dump file. Now we feed it back into the test database:

    mysql --user=root --pass=******* dbTest < c:bkp.sql

    There you go. Depending on the size of the database, this shouldn't take too long. One quick caveat. If you are using InnoDB tables, and have foreign keys set throughout the tables, you will need one intermediate step before feeding the .sql file back in. You need to open the .sql file (in notepad or something similar) and enter the following on the first line:

    SET FOREIGN_KEY_CHECKS=0;

    This will prevent the error that MySQL would produce when it's trying to check the foreign key constraints against records that haven't yet been created.

    Now that was the first part. If you've designed your application properly, and no doubt you have, the second step will be extremely easy. You just need to change the connection settings in your test code to point to the test database instead. Hopefully you have the connection settings in either a global.asa (ASP v3.0) file, or in the web.config (ASP.Net) file. You can just make the change to point to the dbTest server instead. If you are using DSN, you will need to create a new DSN entry for the test database, and point your test code to that.

    More IIS Articles
    More By Justin Cook


     

    IIS ARTICLES

    - Retrieving IIS information using ASP.NET 2.0
    - IIS 6.0, Getting Information Using WMI
    - The Importance of a Domain
    - Implementing a PKI, Part II: Configuring IIS...
    - Creating Test and Production Sites with Only...
    - Authentication and Authorization
    - Beefing Up IIS: 10 Tips From A Former Solari...
    - An Introduction To ISAPI
    - Secure Your Web Server With SSL
    - Introduction to HTML and ASP
    - Instructions to help in Designing your own C...





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 2 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek