open
Open the specified DBMS or path, or connect to the Uniface Router.
open LogonParameters,"
PathName {/net}"
LogonParameters has the following syntax:
{Name}| {UserName}| {Password} {|UST}
Example: open
"myhost:data1|fbaggins|theR1ng", "$MSS"
Parameters
Parameter | Data Type | Description |
---|---|---|
LogonParameters | String | Information necessary to log on to the
specified path. {Name}| {UserName}| {Password} {|UST} You can use LogonParameters to supply information that may be missing from the path, as defined in the assignment file. See Supplying Logon Parameters. |
Name | String | Database name or DBMS network server name (for a DBMS connector), or host name or server name (for a network connector) |
UserName | String | Logon name for the DBMS or Uniface Server. |
Password | String | Password for the UserName |
UST | String | Uniface Server Type as defined in the Uniface Router's assignment file urouter.asn |
PathName | String | Name of a DBMS or network path, such as
$MSS , $DATA , or $TCP , that is defined in the
[PATHS] section of the application assignment file. The leading dollar sign ($) is required. |
/net |
|
Specifies that PathName is a TCP or TLS network path, and is treated as part of the PathName. It can only be used if the path definition in the assignment file also has the /net qualifier. For the following path names, /net is implicit and does not have to be supplied for the path names: $DNP, $TCP, and $TLS. Any path not recognized as a network path is assumed to be a DBMS path. |
Return Values
Value | Meaning |
---|---|
0
|
The path was successfully opened. |
-1
|
Path not found. The path is not specified in the assignment file or is used for parallel transactions. |
-3
|
Exceptional I/O error (hardware or software). |
-4
|
Open request for table or file failed. The table or file is not painted, or it does not exist. |
-9
|
An attempt to open a DBMS failed. This may be because the maximum number of DBMS logons has already been reached, or PathName specifies a TCP or TLS path that is not defined in the assignment file. |
-16
|
Network error: unknown. |
Value | Error constant | Meaning |
---|---|---|
-2 through
-12 |
<UIOSERR_*>
|
Errors during database I/O. |
-16 through
-30 |
<UNETERR_*>
|
Errors during network I/O. |
-1107
|
<UPROCERR_PATH>
|
The path name is not correct or the path does not exist, for example, no assignment is found for the path. |
Use
Allowed in all component types.
Description
Without the /net qualifier, the open statement:
- Logs on to the DBMS via the specified path.
- If path is already open, it performs an implicit close before logging on.
- If it is a TCP or TLS path, this may cause a Uniface Server to be started by the Uniface Router to which the TCP or TLS path leads.
When closing the connection , the database connection is closed, but not the network connection. If the /net qualifier was used to open the path, then closing the path will close the network connection.
With the /net qualifier, the open statement only opens a connection to the Uniface Router, but does not start a Uniface Server. When closing the connection, the network connection is closed.
The open statement can also be
used to connect to the Uniface Router for the purpose of receiving messages sent with
postmessage. To do so, specify "$DNP"
as
PathName. The assignment file must define either a path called
$DNP, or $DEFAULT_NET must be set. The user name and password
supplied in LogonParameters or the assignment file path are ignored. The user
name of the user running the Uniface application is used instead, and no password is sent. The user
name of the user running the Uniface application is used, and no password is sent, so .
The open statement can be placed in several different triggers. Typically, it might be placed in the apStart trigger or the exec operation, when you know which database or databases will be accessed in the course of the application, and wants to allow the user to log on to them all at the beginning.
Supplying Logon Parameters
The [PATHS] section of the assignment file must contain path definitions for the databases, Uniface Servers, and Uniface Routers that the application needs to access. In addition, the assignment settings $DEFAULT_NET and $DEFAULT_TCP_HOST may be set to supply default network information.
At the very least, a path must contain the
connector name, but it may also include the parameters required to log on to the specified database
or server. For more information, see
Path-to-Connector Assignments. Alternatively, logon information can
be supplied in the LogonParameters of the open statement.
However, the LogonParameters cannot specify a connector such as such as
MSS:
or TCP:
. This must be set in the assignment file.
The HostName,
ServerName, UserName, and Password
parameters can each be replaced by a question mark (?
), or completely omitted for
those parameters where the path definition in the assignment file already provides a value.
If a logon parameter is provided in both the assignment file and LogonParameters, the assignment file definition takes precedence.
If a logon parameter is omitted or replaced by a question mark in both places, the value provided by the $DEFAULT_NET assignment setting is used. If $DEFAULT_NET does not supply a host name, the value of $DEFAULT_TCP_HOST is used. If this setting is not present, the system will be asked for the local hostname.
Note: For security purposes, you can obfuscate or encrypt the complete connection string required to open the database using the Pathscrambler utility. For more information, see pathscrambler.exe and Encrypting Paths and Other Sensitive Data Using PathScrambler.
Connecting to a Database
The following example shows how to open an Oracle
database for user scott
, with a password of tiger
. The path $ORA
corresponds to a default path established at installation.
open "|scott|tiger", "$ora"
Connecting to a Network Node
The following example shows how to open network connections for the node SalesHost. The path $SALES/NET corresponds to a path defined in the assignment file and leading to a network driver.
open "SalesHost|user|pass","$sales/net"
Connecting to the Uniface Router
For example, the following example connects to
the Uniface Router with HR
as server type (UST) on the $DNP
path.
open "AdminServer|||HR","$DNP"