OPEN_CONNECTION is used to establish a TCP or IP connection with the specified service.
Applicability
This content applies only to the Oracle-compatible mode of OceanBase Database.
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 name of the host to connect to. If NULL, an error is returned. |
| remote_port | The port number on which the service listens for connections. |
| local_host | The name of the host that the service is provided to. (Reserved field) |
| local_port | The port number on which the service listens for connections. (Reserved field) |
| in_buffer_size | Size of the input buffer (in bytes). A value of 0 indicates that no buffer is used, while NULL indicates that the buffer size has not been explicitly 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 specifies not to use a buffer. A value of NULL specifies not to explicitly set a buffer size, and the operating system controls the size. The maximum buffer size is 32,767 bytes. |
| charset | The character set for data transmission. The character set is converted during data transmission. |
| newline | A line break. It will be added after the text line that is sent by the write_line method. |
| tx_timeout | The wait time (in seconds) for read and write operations on a connection established using the UTL_SMTP package before a timeout occurs. In a read operation, if no data is immediately available for reading, this package times out. In a write operation, if the output buffer is full and data cannot be sent to the network without being blocked, this package times out. The value 0 specifies not to wait, and the value NULL specifies to wait indefinitely. |
| wallet_path | This parameter is currently not supported. If not specified, it defaults to NULL. |
| wallet_password | This field is currently not supported. If not specified, it defaults to NULL. |
Return value
| Return value | Description |
|---|---|
| connection | A TCP/IP connection to the service. |
Considerations
- A maximum of 16 connections can be opened in the same session.
- Connections opened with
open_connectionmust be explicitly closed. These are session-level resources and cannot be used across sessions. All connections for the current session will be closed when the session is disconnected. remote_hostcan be an IP address or a URL, which will be internally converted.local_hostandlocal_portare reserved fields. They are ignored when establishing a TCP/IP connection. In the returnedconnectionvariable, these two fields are set toNULL.