OPEN_CONNECTION is used to open a TCP or IP connection to a specified service.
Applicability
This topic applies only to OceanBase Database in Oracle mode.
Syntax
UTL_TCP.OPEN_CONNECTION (
remote_host IN VARCHAR2,
remote_port IN PLS_INTEGER,
local_host IN VARCHAR2 DEFAULT NULL,
local_port IN PLS_INTEGER DEFAULT NULL,
in_buffer_size IN PLS_INTEGER DEFAULT NULL,
out_buffer_size IN PLS_INTEGER DEFAULT NULL,
charset IN VARCHAR2 DEFAULT NULL,
newline IN VARCHAR2 DEFAULT CRLF,
tx_timeout IN PLS_INTEGER DEFAULT NULL,
wallet_path IN VARCHAR2 DEFAULT NULL,
wallet_password IN VARCHAR2 DEFAULT NULL,
RETURN connection;
Parameters
| Parameter | Description |
|---|---|
| remote_host | The hostname of the service to connect to. If this parameter is NULL, an error is returned. |
| remote_port | The port number on which the service listens for connections. |
| local_host | The hostname to provide to the service. (Reserved parameter). |
| local_port | The port number on which the service listens for connections. (Reserved parameter). |
| in_buffer_size | The size of the input buffer in bytes. A value of 0 indicates that no buffer is used. A value of NULL indicates that the buffer size is not actively set and is controlled by the operating system. The maximum buffer size is 32767 bytes. |
| out_buffer_size | The size of the output buffer in bytes. A value of 0 indicates that no buffer is used. A value of NULL indicates that the buffer size is not actively set and is controlled by the operating system. The maximum buffer size is 32767 bytes. |
| charset | The character set used for online communication, which is converted during data transmission and reception. |
| newline | The newline character. It will be appended to the text line sent by write_line. |
| tx_timeout | The timeout period (in seconds) for read and write operations in the UTL_SMTP package before a connection times out. In read operations, if no data is immediately available to read, the package will timeout. In write operations, if the output buffer is full and no data is sent to the network without being blocked, the package will timeout. A value of 0 indicates no waiting, and a value of NULL indicates waiting indefinitely. |
| wallet_path | This parameter is not supported and defaults to NULL. |
| wallet_password | This parameter is not supported and defaults to NULL. |
Return value
| Return value | Description |
|---|---|
| connection | The TCP/IP connection to the service. |
Considerations
- A session can open up to 16 connections.
- Connections opened by
open_connectionmust be explicitly closed. These connections are session-level resources and cannot be used across sessions. When a session is disconnected, all its connections are closed. remote_hostcan be an IP address or a URL, which will be internally converted.local_hostandlocal_portare reserved parameters and will be ignored when establishing a TCP/IP connection. Theconntectionvariable returned will have these fields set toNULL.
