Login :: Register
General Topics
HostedbyMaximumASP170x35
2005 IIS MVPs
Other IIS Sites
  How do I configure ODBC logging to log to a Microsoft Access Database? 

How do I configure ODBC logging to log to a Microsoft Access Database?

Stage 1 - Create the Database for the log files.

  • Load Microsoft Access 97 or 2000
  • On the initial dialog that is shown select Blank Access Database, and specify a directory and filename name for the database.


  • In this example we will create the database in the c:\inetpub\logfiles folder and give it the name of LogFile.MDB

  • We next need to create a table for the logging. Microsoft have provided a script called LogTemp.SQL that we will use to create the table and the fields, this will save a bit of time for us

    The script is located in the c:\winnt\system32\inetsrv folder. Use notepad to load this script

  • Select all the text and copy it to the clipboard
  • No switch back to the access database and select the Query Object option.
  • Click New to create a new query
  • In the New Query Dialog select Design View
  • Click Close on the Show Table dialog.
  • You are now in the query designer, so select the View menu item and then SQL View menu item.
  • Paste in the SQL  statement we copied from notepad overwriting any existing contents.
  • Close the query editor, it will ask if you want to save it, select yes and give it a name of CreateSQLLog
    Select the query you just saved and DblClick the query name or press enter to execute the query. 


  • You will be shown a dialog like above, click YES to run the data definition query and create the table and fields.
  • Your table will now be created, select the Tables view to see the new table it is called INETLOG

Stage 2 - Create the System DSN

  • We now must create the ODBC System DSN (DSN=Data Source Name)
  • You must open the ODBC Data Source control panel applet. the location of this applet is dependant and names according to your operating system.
  • Windows 2000 Professional = [Start Menu]-[Control Panel]-[Administrative Tools]-Data Sources (ODBC)
  • Windows 2000 Server = [Start Menu]-[Program]-[Administrative Tools]-Data Sources (ODBC)
  • Windows NT 4 Server  = [Start Menu][Control Panel]-[Administrative Tools]-ODBC Data Sources

When you have the ODBC Data Source Administrator running we need to select the SYSTEM DSN tab, you should use the system DSN since it will provide for better performance and is not dependant on the user who is logged onto the computer (if any).


  • Click the Add Button
  • In the list of drivers available select Microsoft Access Database (*.MDB)
  • Click finish
  • You will then get a dialog like below


  • We need to fill in the Data Source Name and the Description and select the database to use.
  • In the DataSourceName field enter  IISLogFile
  • In the Description field enter IIS ODBC Log Files
  • Click the button Select..., you will then be able to navigate to where your database is and select it.
  • After you have done that you click OK to save the new DSN.

Stage 3 - Configure IIS

  • In this section we will configure the default web site for ODBC logging.
  • Open the Internet Services Manager
  • Select the Default Web Site and right click and select properties


  • Enable logging if it is not enabled and select the ODBC logging option from the Active Log format drop down.
  • Click the Properties... button to get to the ODBC properties dialog


  • For the field ODBC Data Source Name (DSN) field enter the name of the DSN you created IISLOGFILE
  • For the field Table enter the table name we created in the access database INETLOG
  • For a Microsoft Access database we can use the Username of Admin and no password.

Now open a web page using your browser that is on the default web site. You will see that the log file is indeed being populated.

 

 This site and its contents are Copyright 1999-2004 by IISFAQ Microsoft Corporation in no way endorses or is affiliated with IISFAQ