Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Specifies configuration settings for logging IIS events to a database through an Open Database Connectivity (ODBC) connection.
Syntax
class OdbcLoggingSection : ConfigurationSection
Methods
The following table lists the methods exposed by the OdbcLoggingSection class.
| Name | Description | 
|---|---|
| (Inherited from ConfigurationSection.) | |
| (Inherited from ConfigurationSection.) | |
| (Inherited from ConfigurationSection.) | |
| (Inherited from ConfigurationSection.) | |
| (Inherited from ConfigurationSection.) | 
Properties
The following table lists the properties exposed by the OdbcLoggingSection class.
| Name | Description | 
|---|---|
| DataSource | A read/write string value that specifies the system DSN (data source name) for the database to which the log is written. The default is "InternetDb". | 
| Location | (Inherited from ConfigurationSection.) A key property. | 
| Password | A read/write string value that specifies the ODBC database password used for writing to the database during event logging. | 
| Path | (Inherited from ConfigurationSection.) A key property. | 
| SectionInformation | (Inherited from ConfigurationSection.) | 
| TableName | A read/write string value that specifies the name of the ODBC database table where information is written during event logging. The default is "InternetLog". | 
| UserName | A read/write string value that specifies the ODBC database user name used for writing to the database during event logging. The default is "InternetAdmin". | 
Subclasses
This class contains no subclasses.
Remarks
ODBC logging allows the logging of IIS data to local Microsoft Access databases or to local or remote Microsoft SQL Server databases.
Example
The following code example specifies new values for the DataSource, Tablename, Username, and Password properties. A helper function displays the values before and after the change.
' Connect to the WMI WebAdministration namespace.
Set oWebAdmin = GetObject( _
    "winmgmts:root\WebAdministration")
' Get the ODBCLoggingSection.
Set oSection = oWebAdmin.Get("OdbcLoggingSection.Path=" & _
    "'MACHINE/WEBROOT/APPHOST',Location=''")
' Display the class name of the section.
WScript.Echo "[ " & oSection.Path_.Class & " ]"
' Display the initial values.
Call DisplayValues("Initial Values", oSection)
' Specify new ODBCLoggingSection property values.
oSection.DataSource = "ODBCLoggingDB"
oSection.TableName = "ODBCLoggingTable"
oSection.Username = "ODBCLoggingAdmin"
oSection.Password = "ODBCLoggingPassword"
' Save the values to configuration.
oSection.Put_
' Refresh the oSection object variable with the new values.
oSection.Refresh_
' Show the changed values.
Call DisplayValues("New Values", oSection)
' ==== DisplayValues helper function. ====
Function DisplayValues(HeadingText, oSection)
    ' Display a heading.
    WScript.Echo
    WScript.Echo HeadingText
    WScript.Echo String(Len(HeadingText), "-")
    ' Display section properties.
    WScript.Echo "Path: " & oSection.Path
    WScript.Echo "Location: " & oSection.Location
    WScript.Echo "DataSource: " & oSection.DataSource
    WScript.Echo "TableName: " & oSection.TableName
    WScript.Echo "Username: " & oSection.Username
    WScript.Echo "Password: " & oSection.Password
End Function
Inheritance Hierarchy
OdbcLoggingSection
Requirements
| Type | Description | 
|---|---|
| Client | Requires IIS 7 on Windows Vista. | 
| Server | Requires IIS 7 on Windows Server 2008. | 
| Product | IIS 7 | 
| MOF file | WebAdministration.mof | 
See Also
Reference
CentralBinaryLogFile Class [IIS 7 and higher]
CentralW3CLogFile Class [IIS 7 and higher]
ConfigurationSection Class [IIS 7 and higher]
HttpLoggingSection Class [IIS 7 and higher]
LogSection Class [IIS 7 and higher]
SiteLogFile Class [IIS 7 and higher]