Compartir a través de


OdbcLoggingSection (clase1)

Especifica los valores de configuración para registrar eventos de IIS en una base de datos mediante una conexión de conectividad abierta de bases de datos (ODBC).

Sintaxis

class OdbcLoggingSection : ConfigurationSection  

Métodos

En la tabla siguiente se enumeran los métodos que expone la clase OdbcLoggingSection.

Nombre Descripción
GetAllowDefinition (Se hereda de ConfigurationSection).
GetAllowLocation (Se hereda de ConfigurationSection).
RevertToParent (Se hereda de ConfigurationSection).
SetAllowDefinition (Se hereda de ConfigurationSection).
SetAllowLocation (Se hereda de ConfigurationSection).

Propiedades

La siguiente tabla muestra las propiedades que expone la clase OdbcLoggingSection.

Nombre Descripción
DataSource Valor string de lectura y escritura que especifica el DSN del sistema (nombre del origen de datos) de la base de datos en la que se escribe el registro. El valor predeterminado es "InternetDb".
Location (Se hereda de ConfigurationSection). Una propiedad clave.
Password Valor string de lectura y escritura que especifica la contraseña de la base de datos ODBC utilizada para escribir en la base de datos durante el registro de eventos.
Path (Se hereda de ConfigurationSection). Una propiedad clave.
SectionInformation (Se hereda de ConfigurationSection).
TableName Valor string de lectura y escritura que especifica el nombre de la tabla de base de datos ODBC donde se escribe información durante el registro de eventos. El valor predeterminado es "InternetLog".
UserName Valor string de lectura y escritura que especifica el nombre de usuario de la base de datos ODBC que se usa para escribir en la base de datos durante el registro de eventos. El valor predeterminado es "InternetAdmin".

Subclases

Esta clase no contiene subclases.

Comentarios

El registro ODBC permite registrar datos de IIS en bases de datos locales de Microsoft Access o en bases de datos locales o remotas de Microsoft SQL Server.

Ejemplo

En el ejemplo de código siguiente se especifican nuevos valores para las propiedades DataSource, Tablename, Username y Password. Una función auxiliar muestra los valores antes y después del cambio.

' 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  
  

Jerarquía de herencia

ConfigurationSection

OdbcLoggingSection

Requisitos

Tipo Descripción
Remoto - IIS 7.0 en Windows Vista
- IIS 7.5 en Windows 7
- IIS 8.0 en Windows 8
- IIS 10.0 en Windows 10
Server - IIS 7.0 en Windows Server 2008
- IIS 7.5 en Windows Server 2008 R2
- IIS 8.0 en Windows Server 2012
- IIS 8.5 en Windows Server 2012 R2
- IIS 10.0 en Windows Server 2016
Producto - IIS 7.0, IIS 7.5, IIS 8.0, IIS 8.5, IIS 10.0
Archivo MOF WebAdministration.mof

Consulte también

CentralBinaryLogFile (clase)
CentralW3CLogFile (clase)
ConfigurationSection (clase)
HttpLoggingSection (clase)
LogSection (clase)
SiteLogFile (clase)
Configuración del registro ODBC en IIS