The ADO Connection object represents an open connection to an OLE DB data source. The Provider property sets the OLE DB provider to use. The connection can be configured before opening the data source by setting the ConnectionString properties. The version of the ADO implementation in use can be determined from the Version property.
The physical connection to the data source is established using the Open method and terminated with the Close method. If errors occur, these can be examined with the Errors collection.
The following Connection object methods, properties, and collections are supported by the current version of the Microsoft® OLE DB Provider for AS/400 and VSAM:
Name | Comment |
---|---|
Close method | Closes a connection to a data source. |
Execute method | Evaluates command text as a table name (only supported Options parameter for this method is adCmdTable). |
Open method | Opens a connection to a data source and may optionally pass ConnectionString parameters with this method. (the only supported Options parameter for this method is adCmdText). |
OpenSchema | Obtains database schema information from the OLE DB provider. |
ConnectionString property | Contains the information used to establish a connection to a data source (see notes following). |
CursorLocation property | Sets or returns the location of the cursor (whether the cursor is on the client or the server side). |
Mode property | Indicates the available permissions for modifying data in a connection. |
Provider property | Sets or returns the name of the provider for a connection. |
State property | Describes the current state of an object. |
Version property | Returns the version number of the ADO implementation in use. |
Errors collection | Collections of Error objects on the connection. |
Properties collection | Collections of properties on the connection. |
The information needed to establish a connection to a data source can be set in the ConnectionString property or passed as part of the Open method. In either case, this information must be in a specific format for use with the OLE DB Provider for AS/400 and VSAM. This information can be a data source name (DSN) or a detailed connection string containing a series of argument=value statements separated by semicolons. ADO supports several standard ADO-defined arguments for the ConnectionString property as follows:
Argument | Description |
---|---|
Data Source | Specifies the name of the data source for the connection. This argument is the Data Source name stored in the registry under the OLE DB Provider for AS/400 and VSAM. |
File Name | Specifies the name of the provider-specific file containing preset connection information. This argument cannot be used if a Provider argument is passed. This argument is not supported by the OLE DB Provider for AS/400 and VSAM. |
Password | Specifies a valid mainframe or AS/400 password to use when opening the connection. This password is used by Microsoft® SNA Server to validate that the user can log on to the target host system and has appropriate access rights to the file. |
Provider | Specifies the name of the provider to use for the connection. To use the OLE DB Provider for AS/400 and VSAM the Provider string must be set to "SNAOLEDB". |
User ID | Specifies a valid mainframe or AS/400 user name to use when opening the connection. This user name is used by SNA Server to validate that the user can log on to the target host system and has appropriate access rights to the file. |
The OLE DB Provider for AS/400 and VSAM also supports a number of provider-specific arguments, some of which will default to values in the registry. These arguments are as follows:
Argument | Description |
---|---|
CCSID | The Code Character Set Identifier (CCSID) attribute indicates the character set used on the host. If this argument is omitted, the default value for CCSID is set to the default value in the registry, typically EBCDIC US English (37). |
CodePage | The character code page to use on the PC. If this argument is omitted, the default value for CodePage is set to the default value in the registry, typically US ASCII (437). This value is only used when configured for custom code page conversion. |
Local LU | The name of the local LU alias configured in the SNA server. |
Mode | The APPC mode (must be set to a value that matches the host configuration and SNA Server configuration). If this argument is omitted, the default value for Mode is set to the default value in the registry. Legal values for the APPC mode include QPCSUPP (5250), #NTER (interactive), #NTERSC (interactive), #BATCH (batch), #BATCHSC (batch), and custom modes. |
RDB | The Remote DataBase name for OS/400. You only need to specify this value if it is different from the remote LU alias configured in the SNA Server. |
Remote LU | The name of the remote LU alias configured in the SNA server. |
A sample ConnectionString follows:
Conn.Open "Provider=SNAOLEDB;Data Source=REMLU;User ID=USERNAME;Password=password;Local LU=LOCAL;Remote LU=DATABASE; Mode=QPCSUPP;CCSID=37;CodePage=437"
A sample Open method call with these parameters follows:
RS.Open "library/member",Conn,1,1,1
The last three parameters to the Open method correspond with the CursorType (the adOpenKeyset enum is 1, for example), LockType (the adLockReadOnly enum is 1, for example), and Options (adCmdText is 1, which indicates that the Source name should be evaluated as a table name). The Options parameter must be set to adCmdText (1) when used with the a data source name with OLE DB Provider for AS/400 and VSAM.
The allowable values for CCSID when using SNANLS (SNA National Language Support) for character code conversions (the default) are as follows:
EBCDIC character set | CCSID value |
---|---|
U.S./Canada | 37 |
Germany | 273 |
Denmark/Norway | 277 |
Finland/Sweden | 278 |
Italy | 280 |
Latin America/Spain | 284 |
United Kingdom | 285 |
France | 297 |
Arabic | 420 |
Greek | 423 |
Hebrew | 424 |
International | 500 |
Thai | 838 |
Multilingual/ROECE (Latin-2) | 870 |
Icelandic | 871 |
Greek (Modern) | 875 |
Cyrillic (Russian) | 880 |
Turkish | 905 |
Cyrillic (Serbian, Bulgarian) | 1025 |
Turkish (Latin-5) | 1026 |
In addition, the following values for CCSID are supported when using TrnsDT-supplied SNANLS character code conversions:
EBCDIC character set | CCSID value |
---|---|
Japanese (Katakana) | 290 |
Japanese (Extended Katakana) | 930 |
Japanese (English-lower) | 931 |
Korean | 933 |
Chinese (Simplified) | 935 |
Chinese (Traditional) | 937 |
Japanese (Extended English) | 939 |
Note SNANLS conversion will automatically use the "default" code page for the default "locale" configured in the registry. For more information on SNANLS, see the SDK documentation on SNA National Language Support.