DTO を使用した Zen サーバーの設定
以下のトピックでは、Distributed Tuning Objects の設定グループを構成するオブジェクトについて説明します。
DtoCategories コレクション
このオブジェクトは、特定の DtoSession オブジェクトに使用できるすべての設定カテゴリを表す DtoCategory オブジェクトのコレクションです。
プロパティ
メソッド
なし
備考
このコレクションでは、1 から始まる序数を渡して個別の項目を取得することができます。
Count プロパティを使用してコレクション内のメンバー数を調べます。
num_categories = my_categories.Count
Item プロパティを使用して、コレクションの 1 から始まるインデックスを取得します。
Set first_item = my_categories(1)
'セッション オブジェクトのインスタンスを作成し、サーバーに接続する
Dim my_session as new DtoSession
Dim result as DtoResult
result = my_session.Connect("myserver", "username", "password")
 
'Categories コレクションを取得する
Dim my_categories as DtoCategories
Set my_categories = my_session.Categories
関連項目
DtoCategory オブジェクト
DtoSession オブジェクト
DtoCategory オブジェクト
このオブジェクトを使用すれば、DtoCategories コレクションの特定のカテゴリで操作を実行することができます。
プロパティ
コレクション
DtoSettings コレクション
メソッド
なし
備考
カテゴリの設定リストを取得するには、Settings プロパティを使って DtoSettings コレクションを返します。その後、その中に含まれる DtoSetting オブジェクトを使って特定の設定に関する情報を取得することができます。
'セッション オブジェクトのインスタンスを作成し、サーバーに接続する
Dim my_session as new DtoSession
Dim result as DtoResult
Dim category as DtoCategory
Dim my_categories as DtoCategories
Dim settings as DtoSettings
result = my_session.Connect("myserver", "username", "password")
 
'Categories コレクションを取得する
Set my_categories = my_session.Categories
 
' コレクション内をループする
For Each category In my_categories
Set settings = category.Settings
Next
関連項目
DtoCategories コレクション
DtoSession オブジェクト
DtoLicenseMgr オブジェクト
DTO2 のみ:このオブジェクトを使用すれば、製品ライセンスの認証と認証解除、ライセンス検証操作の開始、および製品情報の XML 文字列の取得が行えます。
プロパティ
なし
コレクション
なし
メソッド
AddLicense
DeleteLicense
GetProductInfo
ValidateLicenses
備考
Session オブジェクトから取得します。
'セッション オブジェクトのインスタンスを作成し、サーバーに接続する
Dim my_session as new DtoSession
Dim result as DtoResult
Dim my_licmgr as DtoLicenseMgr
 
result = my_session.Connect("myserver", "username", "password")
 
'License Manager オブジェクトを取得する
Set my_licmgr = my_session.LicenseMgr
 
'ライセンスを追加する
 
result = my_licmgr.AddLicense("ERXVD3U4ZS9KR94QPDHV5BN2")
関連項目
DtoSession オブジェクト
メソッドの詳細
AddLicense
ライセンスを認証します。
構文
result = LicenseManager.AddLicense(License)
引数
戻り値
メソッド呼び出しの結果を示す DtoResult(Long 型の値)。DtoSession オブジェクトError プロパティを使って結果の説明を取得します。
'セッション オブジェクトのインスタンスを作成し、サーバーに接続する
Dim my_session as new DtoSession
Dim result as DtoResult
Dim my_licmgr as DtoLicenseMgr
 
result = my_session.Connect("myserver", "username", "password")
 
'License Manager オブジェクトを取得する
Set my_licmgr = my_session.LicenseMgr
 
'ライセンスを追加する
 
result = my_licmgr.AddLicense("ERXVD3U4ZS9KR94QPDHV5BN2")
DeleteLicense
ライセンスを認証解除します。
構文
result = LicenseManager.DeleteLicense(License)
引数
戻り値
メソッド呼び出しの結果を示す DtoResult(Long 型の値)。DtoSession オブジェクトError プロパティを使って結果の説明を取得します。
備考
なし
'セッション オブジェクトのインスタンスを作成し、サーバーに接続する
Dim my_session as new DtoSession
Dim result as DtoResult
Dim my_licmgr as DtoLicenseMgr
 
result = my_session.Connect("myserver", "username", "password")
 
'License Manager オブジェクトを取得する
Set my_licmgr = my_session.LicenseMgr
 
'ライセンスを削除する
 
result = my_licmgr.DeleteLicense("ERXVD3U4ZS9KR94QPDHV5BN2")
GetProductInfo
License Manager で検出されたすべての Zen 製品の一覧を取得します。
構文
result = LicenseManager.GetProductInfo
引数
戻り値
備考
XML 形式の文字列の詳細については、『Distributed Tuning Interface Guide』で PvGetProductsInfo() の備考を参照してください。
'セッション オブジェクトのインスタンスを作成し、サーバーに接続する
Dim session As New DtoSession
Set session = New DtoSession
Dim result As dtoResult
result = session.Connect("server", "user", "password")
 
If result <> Dto_Success Then
MsgBox "Error on connect."& CStr(result)
Exit Sub
End If
Dim xmlstring As String
xmlstring = session.LicenseMgr.GetProductInfo
RichTextBox1.TextRTF = xmlstring
ValidateLicenses
セッション接続によって示されるコンピューターのすべてのキーに関する有効性のチェックを開始します。
構文
result = LicenseManager.ValidateLicenses
引数
戻り値
メソッド呼び出しの結果を示す DtoResult(Long 型の値)。DtoSession オブジェクトError プロパティを使って結果の説明を取得します。
備考
ValidateLicenses は、検証チェックの要求から生じた結果のみを返します。キーの状態に関する情報は何も返しません。キーの状態に関する情報も含め、製品情報の XML 文字列を取得するには、別に GetProductInfo を呼び出す必要があります。
'セッション オブジェクトのインスタンスを作成し、サーバーに接続する
Dim my_session as new DtoSession
Dim result as DtoResult
Dim my_licmgr as DtoLicenseMgr
 
result = my_session.Connect("myserver", "username", "password")
 
'License Manager オブジェクトを取得する
Set my_licmgr = my_session.LicenseMgr
 
'すべてのキーの検証チェックを開始する
result = my_licmgr.ValidateLicenses
 
DtoSettings コレクション
このコレクションには、特定の DtoCategory オブジェクトのすべての設定を表す DtoSetting オブジェクトが含まれます。
プロパティ
メソッド
なし
備考
Count プロパティを使用してコレクション内のメンバー数を調べます。
このコレクションでは、1 から始まる序数または設定名を含むバリアントを渡して個別の項目を取得することができます。
メモ:  また、DtoSession オブジェクトの GetSetting を使って個別の設定を取得することもできます。これにより、カテゴリと設定内のループを節約します。
Dim my_categories as DtoCategories
Set my_categories = my_session.Categories
 
Dim my_settings as DtoSettings
Dim first_setting as DtoSetting
Set my_settings = my_categories.Settings
Set first_setting = my_settings(1)
関連項目
DtoCategories コレクション
DtoCategory オブジェクト
DtoSetting オブジェクト
このオブジェクトは、環境設定を表します。
プロパティ
設定タイプ(設定タイプ列挙)を返します。
たとえば、secondsbytes などです。
コレクション
DtoSelectionItems コレクション
メソッド
なし
備考
Type プロパティを使用して設定のタイプを見つけます。次のタイプによって異なることに注意してください。
TrueString および FalseString プロパティはブール型の設定(0)にのみ適用されます。
FactorFactorStringMaxMin および UnitString プロパティは Long 型の設定(1)にのみ適用されます。
Set my_settings = my_category.Settings
Set first_setting = my_settings(1)
関連項目
DtoCategories コレクション
DtoCategory オブジェクト
DtoSelectionItems コレクション
選択タイプの設定で、選択可能な値を表す DtoSelectionItem オブジェクトのコレクション。
プロパティ
メソッド
Add
GetById
Remove
備考
DtoSetting オブジェクトAllPossibleSelections プロパティは、DtoSelectionItems コレクションを返します。
Count プロパティを使用してコレクション内のメンバー数を調べます。
Set first_setting = my_settings(1)
 
type = first_setting.Type
 
'選択タイプの設定の場合のみこれを呼び出す
'設定タイプの一覧は、設定タイプ列挙を参照
 
if (type = dtoSingleSel) OR (type = dtoMultiSel)
Set all_the_selections = first_setting.AllPossibleSelections
関連項目
DtoCategories コレクション
DtoSetting オブジェクト
メソッドの詳細
Add
DtoSelectionItems コレクションに項目を追加します。
構文
result = Collection.Add(Object)
引数
戻り値
メソッド呼び出しの結果を示す DtoResult(Long 型の値)。DtoSession オブジェクトError プロパティを使って結果の説明を取得します。
備考
このメソッドには DtoSelectionItem タイプのパラメーターが必要です。このため、コレクションにオブジェクトを追加する前に、まずオブジェクトのインスタンスを作成してそのプロパティを設定する必要があります。
Dim Result As dtoResult
Dim Session As New DtoSession
Result = Session.Connect("nik-ntws", "", "")
Dim my_setting As DtoSetting
Dim SetID As Long
SetID = 26
Set my_setting = Session.GetSetting(SetID)
If my_setting Is Nothing Then
MsgBox " Setting is wrong"
Exit Sub
End If
 
'新しい値の割り当てを開始する
'ItemID 1 で項目を追加する
new_selections.Add my_setting.AllPossibleSelections.Item(1)
'TCP
 
my_setting.Value = new_selections
GetById
指定した ID で DtoSelectionItems コレクションから DtoSelectionItem オブジェクトを返します。
構文
my_selection_item = Collection.GetById(id)
引数
戻り値
Dim Result As DtoResult
Dim Session As New DtoSession
Result = Session.Connect("nik-ntws", "", "")
Dim my_setting As DtoSetting
Dim SetID As Long
SetID = 26
Set my_setting = Session.GetSetting(SetID)
If my_setting Is Nothing Then
MsgBox " Setting is wrong"
Exit Sub
End If
 
Dim new_selections As New DtoSelectionItems
new_selections.Add my_setting.AllPossibleSelections.GetByID(3) 'Microsoft TCP/IP
 
my_setting.Value = new_selections
Remove
DtoSelectionItems コレクションから項目を削除します。
構文
result = Collection.Remove(item)
引数
戻り値
メソッド呼び出しの結果を示す DtoResult(Long 型の値)。DtoSession オブジェクトError プロパティを使って結果の説明を取得します。
備考
このメソッドには DtoSelectionItem タイプのパラメーターが必要です。
Dim Result As DtoResult
Dim Session As New DtoSession
Result = Session.Connect("nik-ntws", "", "")
Dim my_setting As DtoSetting
Dim SetID As Long
SetID = 26
Set my_setting = Session.GetSetting(SetID)
If my_setting Is Nothing Then
MsgBox " Setting is wrong"
Exit Sub
End If
 
Dim new_selections As New DtoSelectionItems
new_selections.Add my_setting.AllPossibleSelections.GetByID(3) ''Microsoft TCP/IP
new_selections.Remove(1)
 
my_setting.Value = new_selections
DtoSelectionItem オブジェクト
選択タイプの設定で選択可能な値を表すオブジェクトです。
プロパティ
メソッド
なし
備考
DtoSetting オブジェクトAllPossibleSelections プロパティは DtoSelectionItems コレクションを返します。
Set first_setting = my_settings.Item(1)
 
Dim type as dtoSettingType
type = first_setting.Type
 
'選択タイプの設定の場合のみこれを呼び出す
'設定タイプの一覧は、設定タイプ列挙を参照
 
if (type = dtoSingleSel) OR (type = dtoMultiSel) then
Dim all_the_selections as DtoSelectionItems
Dim selection as DtoSelectionitem
Set all_the_selections = first_setting.AllPossibleSelections
 
Dim String_text as String
For each selection in all_the_selections
String_text = selection.String
Next
関連項目
DtoSelectionItems コレクション
DtoSetting オブジェクト
DtoServices オブジェクト
このオブジェクトは DtoService オブジェクトのコレクションです。これはサーバーで起動している Zen サービスを表します。
プロパティ
メソッド
RestartAllServices
StartRelational
StartTransactional
StopRelational
StopTransactional
StartDXAgent
StartDXReplication
StopDXAgent
StopDXReplication
備考
DtoServices のメソッドは、DtoSession オブジェクトを使って接続するコンピューターで起動している Zen エンジンのサービスを制御します。これらのメソッドはすべて DtoResult 列挙を返します。
このオブジェクトによって、Windows プラットフォームで起動している Zen エンジンのサービスを開始および停止することができます。また、Status または StatusString プロパティを使って Zen サービスの現在の状態を照会することができます。
DtoServices オブジェクトに関するセキュリティ情報
DTO の Web アプリケーションからサービスを開始/停止できるように IIS を構成するには
1.
スタート]メニューから[設定]を選択し、[コントロール パネル]をポイントします。
2.
管理ツール]をダブルクリックします。
3.
インターネット サービス マネージャー]をダブルクリックします。
4.
5.
左ペインのフォルダーを右クリックして[プロパティ]を選択します。
6.
ディレクトリ]タブをクリックします。
7.
DtoServices のメソッドの IIS ディレクトリ プロパティに対して、ダイアログ ボックスの[アプリケーション保護]フィールドで "低(IIS プロセス)" を指定します。
'この例では、サーバーに接続し、
'すべての Zen サービスを再開する
 
Dim my_session as new DtoSession
Dim my_services as DtoServices
Dim result as DtoResult
 
result = my_session.Connect("myserver", "username", "password")
Set my_services = my_session.Services
result = my_services.RestartAllServices
 
'この例では、サーバーに接続し、
'DataExchange (DX) エージェント サービスと DX レプリケーション サービスを
'再開する
 
Dim my_session as new DtoSession
Dim my_services as DtoServices
Dim result1 as DtoResult
Dim result2 as DtoResult
 
result = my_session.Connect("myserver", "username", "password")
Set my_services = my_session.Services
result1 = my_services.StartDXReplication
result2 = my_services.StartDXAgent
関連項目
DtoSession オブジェクト
DtoSetting オブジェクト
メソッドの詳細
RestartAllServices
トランザクショナル サービス、リレーショナル サービス、DataExchange(DX)エージェントおよび DX レプリケーション サービスを停止して再開始します。
構文
result = Services.RestartAllServices
引数
戻り値
メソッド呼び出しの結果を示す DtoResult(Long 型の値)。DtoSession オブジェクトError プロパティを使って結果の説明を取得します。
StartRelational
リレーショナル サービスを開始します。Zen v14 以降、これは StartTransactional メソッドと同じです。
構文
result = Services.StartRelational
引数
戻り値
メソッド呼び出しの結果を示す DtoResult(Long 型の値)。DtoSession オブジェクトError プロパティを使って結果の説明を取得します。
StartTransactional
Btrieve トランザクショナル サービスを開始します。Zen v14 以降、これは StartRelational メソッドと同じです。
構文
result = Services.StartTransactional
引数
戻り値
メソッド呼び出しの結果を示す DtoResult(Long 型の値)。DtoSession オブジェクトError プロパティを使って結果の説明を取得します。
StopRelational
リレーショナル エンジン サービスを停止します。Zen v14 以降、これは StopTransactional メソッドと同じです。
構文
result = Services.StopRelational
引数
戻り値
メソッド呼び出しの結果を示す DtoResult(Long 型の値)。DtoSession オブジェクトError プロパティを使って結果の説明を取得します。
StopTransactional
Btrieve トランザクショナル エンジン サービスを停止します。Zen v14 以降、これは StopRelational メソッドと同じです。
構文
result = Services.StopTransactional
引数
戻り値
メソッド呼び出しの結果を示す DtoResult(Long 型の値)。DtoSession オブジェクトError プロパティを使って結果の説明を取得します。
StartDXAgent
DataExchange(DX)エージェント サービスを開始します。DX エージェントは、レプリケーションでの重大な障害を検出し、管理者に電子メールで通知するコンポーネントです。詳細については、DataExchange ドキュメントを参照してください。
DX エージェント サービスは、DX レプリケーション サービスを開始する前でも開始することができますが、その場合はレプリケーション サービスが停止していることを通知するメッセージがエージェントから返されます。レプリケーション サービスがまだ実行していないため、これは正常な動作です。
構文
result = Services.StartDXAgent
引数
戻り値
メソッド呼び出しの結果を示す DtoResult(Long 型の値)。DtoSession オブジェクトError プロパティを使って結果の説明を取得します。
StartDXReplication
DataExchange(DX)レプリケーション サービス(レプリケーション エンジン)を開始します。レプリケーション エンジンでは、DataExchange レプリケーション ネットワーク内で、どれか 1 つの Zen データベースの変更を捕捉し、それをほかのデータベースと共有することができます。詳細については、DataExchange ドキュメントを参照してください。
レプリケーション サービスを開始すると、トランザクショナル サービスやリレーショナル サービスも開始します。
構文
result = Services.StartDXReplication
引数
戻り値
メソッド呼び出しの結果を示す DtoResult(Long 型の値)。DtoSession オブジェクトError プロパティを使って結果の説明を取得します。
StopDXAgent
DataExchange(DX)エージェント サービスを停止します。DX エージェントは、レプリケーションでの重大な障害を検出し、管理者に電子メールで通知するコンポーネントです。詳細については、DataExchange ドキュメントを参照してください。
構文
result = Services.StopDXAgent
引数
戻り値
メソッド呼び出しの結果を示す DtoResult(Long 型の値)。DtoSession オブジェクトError プロパティを使って結果の説明を取得します。
StopDXReplication
DataExchange(DX)レプリケーション エンジンを停止します。レプリケーション エンジンでは、DataExchange レプリケーション ネットワーク内で、どれか 1 つの Zen データベースの変更を捕捉し、それをほかのデータベースと共有することができます。詳細については、DataExchange ドキュメントを参照してください。
構文
result = Services.StopDXReplication
引数
戻り値
メソッド呼び出しの結果を示す DtoResult(Long 型の値)。DtoSession オブジェクトError プロパティを使って結果の説明を取得します。