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 |
---|---|
GetAllowDefinition | (Inherited from ConfigurationSection.) |
GetAllowLocation | (Inherited from ConfigurationSection .) |
RevertToParent | (Inherited from ConfigurationSection .) |
SetAllowDefinition | (Inherited from ConfigurationSection .) |
SetAllowLocation | (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 | - IIS 7.0 on Windows Vista - IIS 7.5 on Windows 7 - IIS 8.0 on Windows 8 - IIS 10.0 on Windows 10 |
Server | - IIS 7.0 on Windows Server 2008 - IIS 7.5 on Windows Server 2008 R2 - IIS 8.0 on Windows Server 2012 - IIS 8.5 on Windows Server 2012 R2 - IIS 10.0 on Windows Server 2016 |
Product | - IIS 7.0, IIS 7.5, IIS 8.0, IIS 8.5, IIS 10.0 |
MOF file | WebAdministration.mof |
See Also
CentralBinaryLogFile Class
CentralW3CLogFile Class
ConfigurationSection Class
HttpLoggingSection Class
LogSection Class
SiteLogFile Class
How to configure ODBC logging in IIS