Developer Reference : Platform Management : Distributed Tuning Objects (DTO) Guide : Creating and Maintaining Catalogs and Dictionaries with DTO : DtoDSN Object
 
DtoDSN Object
An object representing a Zen DSN.
Properties
DbName
Gets or sets the Dbname associated with the DSN.
Description
Gets or sets the description of the DSN.
Name
Gets or sets the name of the DSN.
OpenMode
Gets or sets the open mode enumeration of the DSN.
See DSN Open Mode for a list of possible values.
Session
Gets or sets the DtoSession object associated with this DtoDSN object.
Translate
Gets or set the encoding translation, which specifies how character data is translated between the database engine and a client application. This property is an enumeration. See DSN Translate Option for a list of values.
Methods
None
Remarks
To obtain information about a particular database, use the DtoDatabase Object.
Examples
To Query the DbName Associated with a DSN
’ instantiate session object
Dim my_session as New DtoSession
’ connect to a server
my_session.Connect("myserver", "username", "password")
’ now use your session object to obtain db collection
my_dsns = my_session.DSNs
first_dsn = my_dsns.Item(1)
dsn_dbname = first_dsn.DbName
 
To Add a New DSN
’ instantiate session object
Dim my_session as New DtoSession
Dim result as dtoResult
 
’ connect to a server
result = my_session.Connect("myserver", "username", "password")
’ now use your session object to obtain DSN collection
Dim my_dsns as DtoDSNs
Set my_dsns = my_session.DSNs
 
’ Populate new DtoDSN object
Dim NewDSN as New DtoDSN
NewDSN.DbName = "DEMODATA"
NewDSN.Description = "A DSN for the DEMODATA db"
NewDSN.Name = "Demodata_DSN"
 
’ now add the new DSN to the collection
result = my_dsns.Add(NewDSN)
 
To Get or Set the Encoding Translation
Dim m_dtoSession1 As New DtoSession
Dim result As dtoResult
result = m_dtoSession1.Connect("localhost", "", "")
Dim sTranslate As String
Dim iTranslate As Integer
iTranslate = m_dtoSession1.DSNs("DEMODATA").Translate
If iTranslate = 0 Then sTranslate = "None"
If iTranslate = 1 Then sTranslate = "OEM/ANSI Conversion"
If iTranslate = 2 Then sTranslate = "Automatic"
MsgBox "DSN Translate Setting (before change): " & sTranslate
If result = Dto_Success Then
Rem set the encoding translation.
m_dtoSession1.DSNs("DEMODATA").Translate = 1
End If
iTranslate = m_dtoSession1.DSNs("DEMODATA").Translate
If iTranslate = 0 Then sTranslate = "None"
If iTranslate = 1 Then sTranslate = "OEM/ANSI Conversion"
If iTranslate = 2 Then sTranslate = "Automatic"
MsgBox "DSN Translate Setting (after change): " & sTranslate
m_dtoSession1.Disconnect
See Also
DtoDSNs Collection
DtoSession Object