The online FAQ database contains hundreds of answers to frequently asked questions, articles on using our
web server applications and other related technologies, and resolutions to common problems. If you are seeing
an error message, be sure to try searching on the error message or error number that you are seeing.
|
| |
| |
| |
| |
|
|
Database connection strings are what tell the system where and how to read/write to the Access/Jet MDB database file. The default connection strings are fine for most IIS server installations, but there are times where you need to change the connection string for a variety of reasons. The connection string is changed by altering the gsConnect setting in the configuration file.
Changing the connection string can be done for many different reasons. The primary reason is to increase your web site security. By default, the MDB file is usually located in the same directory as the ASP application. You can make your site's data much more secure by changing this for the default configuration by renaming or moving the MDB database file. Some web site administrators are also used to using DSN based connections. The connection string can be changed to support a DSN based connection to the database also. However, contrary to popular rumors, DSN based connections are not faster than DSN-less connections. In most cases the opposite is true.
To use a DSN based connection, you first setup the DSN using the ODBC DataSources application to create the System DSN. When you create the DSN, you give the DSN a name. You simply supply this name in the connection string as shown below. If your new DSN connection name was MyDatabase, then your configuration file would use a line like:
gsConnect = "DSN=MyDatabase"
If you change the name of the MDB file, you just need to update the connection string to reflect the correct name of the MDB file. If you change the name of the MDB file to good obscure file name, like MyDB-4f8j3hs8.MDB, then you would update your connection string as shown below:
gsConnect = "Driver={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath(".\MyDB-4f8j3hs8.MDB")
If you want to move the MDB file to a different location, you just need to specify the full path to the MDB. Remember, the path to the MDB is from the server's point of view and must be accessable to the server at all times. There are some problems with the Microsoft Access/Jet database engine that can occur if the MDB file is stored on a machine that is different than the IIS server is running on. So it is always a good idea to keep the MDB file on a local drive of the IIS server. Also, do not use UNC paths, make sure you use a drive letter path. To specifiy a path in this manner, you would use a setting like:
gsConnect = "Driver={Microsoft Access Driver (*.mdb)};DBQ=G:\Databases\MyDatabase.MDB"
|
|
|
|
| |