OPEN_CONNECTION v14
The OPEN_CONNECTION function establishes a network connection to a specified host and port, returning a connection handle used for subsequent data transfer operations.
OPEN_CONNECTION ( remote_host IN VARCHAR2(255) DEFAULT NULL, remote_port IN INTEGER, local_host IN VARCHAR2(255) DEFAULT NULL, local_port IN INTEGER DEFAULT NULL, in_buffer_size IN INTEGER DEFAULT NULL, out_buffer_size IN INTEGER DEFAULT NULL, charset IN VARCHAR2(30) DEFAULT NULL, newline IN VARCHAR2(2) DEFAULT NULL, tx_timeout IN INTEGER DEFAULT NULL, ) RETURN connection;
Parameters
remote_host
The DNS name or IP address of the remote host to which you are connecting. If remote_host is NULL, the function uses the local host and port for the connection.
remote_port
The TCP port number of the remote host.
local_host
The local network interface address to bind to. If NULL, then system gives you an error.
local_port
The local TCP port number to bind to. If NULL, then system gives you an error.
in_buffer_size
The size (in bytes) of the input buffer used for receiving data.
out_buffer_size
The size (in bytes) of the output buffer used for sending data.
charset
The character set to be used for data transmission (e.g., 'UTF-8'). This parameter is accepted and not processed by the function.
newline
The newline character is appended to the text line sent by WRITE_LINE function.
tx_timeout
The timeout duration (in seconds) for transmission operations.
Return value
| Type | Description |
|---|---|
connection | A record handle representing the active network session. This handle must be passed to subsequent read/write or close procedures. |
Notes
Defaults: Most parameters are optional. At a minimum,
remote_portmust be specified ifremote_hostis handled by the underlying environment or defaults.Resource management: Every connection opened with this function should eventually be closed using the corresponding
CLOSE_CONNECTIONprocedure to prevent resource leaks.Buffer tuning: For high-throughput applications, adjusting
in_buffer_sizeandout_buffer_sizecan significantly impact performance based on the network MTU.
Example
DECLARE c UTL_TCP.CONNECTION; BEGIN c := UTL_TCP.OPEN_CONNECTION('mail-arts.enterprisedb.com', 25); UTL_TCP.CLOSE_CONNECTION(c); END;
- On this page
- Parameters
- Return value
- Notes
- Example