The OPEN_CONNECTION procedure opens 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 name of the host to which the connection is to be made. If this parameter is NULL, an error will be returned. |
| remote_port | The port number on which the service listens for connections. |
| local_host | The name of the host to be provided 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. If this parameter is 0, no buffer is used. If this parameter is NULL, the buffer size is not 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. If this parameter is 0, no buffer is used. If this parameter is NULL, the buffer size is not explicitly set and is controlled by the operating system. The maximum buffer size is 32767 bytes. |
| charset | The character set used for data sent and received. |
| newline | The newline character. This character will be appended to the text line sent by write_line. |
| tx_timeout | The number of seconds that the UTL_TCP package waits for a read or write operation to time out on the connection. In a read operation, if no data is immediately available to read, the package will time out. In a write operation, if the output buffer is full and no data is sent to the network without being blocked, the package will time out. 0 indicates no waiting, and 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 a maximum of 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 connections associated with that session 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.