OdbcLoggingSection クラス 1

Open Database Connectivity (ODBC) 接続を使って IIS イベントをデータベースにログするための構成設定を指定します。

構文

class OdbcLoggingSection : ConfigurationSection  

メソッド

次の表に、OdbcLoggingSection クラスによって公開されるメソッドの一覧を示します。

名前 説明
GetAllowDefinition (ConfigurationSection から継承。)
GetAllowLocation (ConfigurationSection から継承。)
RevertToParent (ConfigurationSection から継承。)
SetAllowDefinition (ConfigurationSection から継承。)
SetAllowLocation (ConfigurationSection から継承。)

プロパティ

次の表は、OdbcLoggingSection クラスによって公開されるプロパティの一覧です。

名前 説明
DataSource ログの書き込み先となるデータベースのシステム DSN (データ ソース名) を指定する、読み取り/書き込みの string 値。 既定値は "InternetDb" です。
Location (ConfigurationSection から継承。)キー プロパティ。
Password イベント ログ時にデータベースに書き込む際に使う ODBC データベースのパスワードを指定する、読み取り/書き込みの string 値。
Path (ConfigurationSection から継承。)キー プロパティ。
SectionInformation (ConfigurationSection から継承。)
TableName イベント ログ時に情報が書き込まれる ODBC データベース テーブルの名前を指定する、読み取り/書き込みの string 値。 既定値は "InternetLog" です。
UserName イベント ログ時にデータベースに書き込む際に使う ODBC データベースのユーザー名を指定する、読み取り/書き込みの string 値。 既定値は "InternetAdmin" です。

サブクラス

このクラスにはサブクラスが含まれていません。

解説

ODBC ログを使うと、ローカルの Microsoft Access データベースまたはローカルかリモートの Microsoft SQL Server データベースに IIS データをログできます。

次のコード例では、DataSourceTablenameUsernamePassword の各プロパティに新しい値を指定します。 ヘルパー関数を使って、変更の前後の値を表示します。

' 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  
  

継承階層

ConfigurationSection

OdbcLoggingSection

要件

説明
クライアント - Windows Vista 上の IIS 7.0
- Windows 7 上の IIS 7.5
- Windows 8 上の IIS 8.0
- Windows 10 上の IIS 10.0
[サーバー] - Windows Server 2008 上の IIS 7.0
- Windows Server 2008 R2 上の IIS 7.5
- Windows Server 2012 上の IIS 8.0
- Windows Server 2012 R2 上の IIS 8.5
- Windows Server 2016 上の IIS 10.0
Product - IIS 7.0、IIS 7.5、IIS 8.0、IIS 8.5、IIS 10.0
MOF ファイル WebAdministration.mof

参照

CentralBinaryLogFile クラス
CentralW3CLogFile クラス
ConfigurationSection クラス
HttpLoggingSection クラス
LogSection クラス
SiteLogFile クラス
IIS で ODBC ログを構成する方法