Database Notes and Alterations Information

See Also: Read Me and Upgrading from Version 1

Changing the Location of the Database

When you unzip the original files, the site is set up with the database in the data folder. If you put the main folder (userpages2) in the directory "C:\Inetpub\wwwroot\userpages2" or your root web folder, then you shouldn't need to change the code in this file. This is the current connection string used for running the application within your root web directory (e.g.. C:\Inetpub\wwwroot)
<%
' FileName="Connection_ado_conn_string.htm"
' Type="ADO"
' HTTP="true"
' Catalog=""
' Schema=""
MM_conn_db_STRING = "Driver={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("/userpages2/data/db.mdb") & ";"
%>

Note: when testing, editing and for showing live data view from within UltraDev, you must have your web server running at the time (from IIS/PWS - "Default Web Site" is running) for the connection to be made as it uses a data connection on the application server. You do not need to have the web server running if you use a DSN - a DSN does not use the application server to check the connection from within UltraDev.

For running the application (userpages2) from another directory, you will probably have to edit the file conn_db.asp to point to the right path of the database.
Example A: if you have the folder userpages inside a folder called "development", then the path should read:
MM_conn_db_STRING = "Driver={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("/development/userpages2/data/db.mdb") & ";"

If you put your database in a different directory, you will need to edit the file conn_db.asp to map to where the database is.
Example B: if you have the database in your "cgi-bin" folder (root web directory/cgi-bin) on the server, the connection would need to be:
MM_conn_db_STRING = "Driver={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("/cgi-bin/db.mdb") & ";"

If you put your database in folder above the root directory, you will need to make a DSN.
Example C: to refer to the DSN that has been made to connect to your database, the file conn_db.asp will look like this:
<%
' Filename="Connection_odbc_conn_dsn.htm"
' Type="ADO"
' HTTP="false"
' Catalog=""
' Schema=""
MM_conn_db_STRING = "dsn=userpages2;"
%>

Where the name of the DSN is usepages2 (this will be whatever you called the DSN when it is made - may be any name you like but it must be stated within the conn_db.asp file as above).

There is some info on using connections from Macromedia at: http://www.macromedia.com/support/ultradev/ts/documents/mappath_in_connection_strin.htm

Protecting Your Database
If you run this site on a remote server (i.e. not on your local machine), it is advisable to change the database path to stop other users obtaining it.
The ideal location to place your database is above your root web folder, so it is not accessible from a http address and can only be accessed through FTP. The simplest way to define a connection in this case is by creating a DSN (data source name). The way you create your DSN will depend on what access you have to the server. There is also a guide defining how you set up a DSN within the UltraDev help section (press F1 to get help within UltraDev).

The FTP view of your domain may look something like the screen-shot below. In this case, the folder "database" is above the root (htdocs is the root web folder here) and is not accessible by a web address.

FTP Structure

 

Examples of Possible Folder Layout on the Server

I have outlined what some of the possible folders on the server may be to store your database


    Folders above your Root Directory

   |

    Data
(this is a "safe" place to store your database, but you or your system administrator will need to create a DSN to connect to it)
   |

   
Y
our Root Web Folder (this folder may also be called www.mydomain.com or www or htdocs or wwwroot)
       |
       |__ default.htm (your normal default page (home page) for your web site)
       |
       |__ other folders and files you have on your server etc. will be in this "root" folder
       |
       |
       |__ cgi-bin (if you have one made by your system administrator it usually has write permissions already set so your database can be stored here)
       |
       |
       |__ userpages2 (this is the default userpages2 folder and where it would go))
       |                    |__ _mmDBScripts
       |                    |__ Connections
       |                    |__ css
       |                    |__ data
       |                    |          |__ db.mdb (this is the original location of the database in userpages2)
       |                    |
       |                    |__ images
       |                    |__ includes
       |                    |__ registration
       |                    |__ ScriptLibrary
       |                    |__ uploads
       |                    |             |__ userpics (folder)
       |                    |             |              |__ *the made folders will be here*
       |                    |             |
       |                    |             |__ other ASP files etc.
       |                    |
       |                    |
       |                    |__ user_pages
       |                                       |__ editor_images (folder)
       |                                       |
       |                                       |__ other ASP files etc.
       |
       |

 

 

See Also: Read Me and Upgrading from Version 1