Package oracle.jdbc
Interface OracleConnectionStringBuilder
-
public interface OracleConnectionStringBuilder
- Since:
- 20c
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
OracleConnectionStringBuilder.ConnectInfo
This class represents the ADDRESS node of the TNS Connect String.
-
Field Summary
Fields Modifier and Type Field Description static String
PROTOCOL_TCP
static String
PROTOCOL_TCPS
static String
PROTOCOL_WSS
static String
SERVER_MODE_DEDICATED
static String
SERVER_MODE_POOLED
static String
SERVER_MODE_SHARED
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description OracleConnectionStringBuilder
addConnectInfo(String host, int port)
Creating a new ConnectInfo using the given host and port value and adds to the ConnectInfoList.OracleConnectionStringBuilder
addConnectInfo(OracleConnectionStringBuilder.ConnectInfo connectInfo)
Adds the given ConnectInfo to the ConnectInfoList which will be used for creating the TNS connect string.String
build()
Builds the TNS ConnectString using the provided values and returns the built value.String
buildThinStyleURL()
It works the same way asbuild()
, but It adds the prefix required by the JDBC Thin Driver to resolve the driver type.OracleConnectionStringBuilder
connectTimeout(int connectTimeout)
Used to configure the value of CONNECT_TIMEOUT in the DESCRIPTION node.OracleConnectionStringBuilder
instanceName(String instanceName)
Used to configure the value of INSTANCE_NAME in the CONNECT_DATA node.OracleConnectionStringBuilder
loadBalance(boolean loadBalance)
Used to configure the value of LOAD_BALANCE in the ADDRESS_LIST node.static OracleConnectionStringBuilder
newInstance()
Factory method for creating a new instance of OracleConnectionBuilder.OracleConnectionStringBuilder
retryCount(int retryCount)
Used to configure the value of RETRY_COUNT in the DESCRIPTION node.OracleConnectionStringBuilder
retryDelay(int retryDelay)
Used to configure the value of RETRY_DELAY in the DESCRIPTION node.OracleConnectionStringBuilder
serverDN(String serverDN)
Used to configure the value of SSL_SERVER_CERT_DN in the SECURITY node.OracleConnectionStringBuilder
serverMode(String serverMode)
Used to configure the value of SERVER in the CONNECT_DATA node.OracleConnectionStringBuilder
serviceName(String serviceName)
Used to configure the value of SERVICE_NAME of the CONNECT_DATA node.OracleConnectionStringBuilder
transportConnectTimeout(int transportConnectTimeout)
Used to configure the value of TRANSPORT_CONNECT_TIMEOUT in the DESCRIPTION node.OracleConnectionStringBuilder
walletDirectory(String walletDirectory)
Used to configure the value of MY_WALLET_DIRECTORY in the SECURITY node.
-
-
-
Field Detail
-
SERVER_MODE_DEDICATED
static final String SERVER_MODE_DEDICATED
- See Also:
- Constant Field Values
-
SERVER_MODE_SHARED
static final String SERVER_MODE_SHARED
- See Also:
- Constant Field Values
-
SERVER_MODE_POOLED
static final String SERVER_MODE_POOLED
- See Also:
- Constant Field Values
-
PROTOCOL_TCP
static final String PROTOCOL_TCP
- See Also:
- Constant Field Values
-
PROTOCOL_TCPS
static final String PROTOCOL_TCPS
- See Also:
- Constant Field Values
-
PROTOCOL_WSS
static final String PROTOCOL_WSS
- See Also:
- Constant Field Values
-
-
Method Detail
-
newInstance
static OracleConnectionStringBuilder newInstance()
Factory method for creating a new instance of OracleConnectionBuilder.- Returns:
- oracleConnectionBuilder
-
addConnectInfo
OracleConnectionStringBuilder addConnectInfo(OracleConnectionStringBuilder.ConnectInfo connectInfo)
Adds the given ConnectInfo to the ConnectInfoList which will be used for creating the TNS connect string. The ConnectInfo is ADDRESS part of the TNS Connect String. A connect string can have more than one ADDRESS nodes. Please see the below example to know how to create a new OracleConnectionStringBuilder.ConnectInfo instance.ConnectInfo connectInfo = ConnectInfo .newInstance() .host("mydbhost") .port(5521) .protocol(OracleConnectionStringBuilder.PROTOCOL_TCP);
- Parameters:
connectInfo
-- Returns:
- oracleConnectionBuilder
-
addConnectInfo
OracleConnectionStringBuilder addConnectInfo(String host, int port)
Creating a new ConnectInfo using the given host and port value and adds to the ConnectInfoList. The Protocol will be "TCP" by default. To configure ConnectInfo with different parameters useaddConnectInfo(ConnectInfo)
.- Parameters:
host
-port
-- Returns:
- oracleConnectionBuilder
-
serviceName
OracleConnectionStringBuilder serviceName(String serviceName)
Used to configure the value of SERVICE_NAME of the CONNECT_DATA node.- Parameters:
serviceName
-- Returns:
- oracleConnectionBuilder
-
serverMode
OracleConnectionStringBuilder serverMode(String serverMode)
Used to configure the value of SERVER in the CONNECT_DATA node. Following are the valid values,SERVER_MODE_DEDICATED
SERVER_MODE_POOLED
SERVER_MODE_SHARED
- Parameters:
serverMode
-- Returns:
- oracleConnectionBuilder
-
instanceName
OracleConnectionStringBuilder instanceName(String instanceName)
Used to configure the value of INSTANCE_NAME in the CONNECT_DATA node.- Parameters:
instanceName
-- Returns:
- oracleConnectionBuilder
-
serverDN
OracleConnectionStringBuilder serverDN(String serverDN)
Used to configure the value of SSL_SERVER_CERT_DN in the SECURITY node. Configured value will used for validating the server certificate while connection establishment. This value is used only if the protocol is "TCPS".- Parameters:
serverDN
-- Returns:
- oracleConnectionBuilder
-
walletDirectory
OracleConnectionStringBuilder walletDirectory(String walletDirectory)
Used to configure the value of MY_WALLET_DIRECTORY in the SECURITY node. This value is used only if the protocol is "TCPS" or "WSS".- Parameters:
walletDirectory
-- Returns:
- oracleConnectionBuilder
-
loadBalance
OracleConnectionStringBuilder loadBalance(boolean loadBalance)
Used to configure the value of LOAD_BALANCE in the ADDRESS_LIST node. Setting it to false will disable the load balancing. The default value is true.- Parameters:
loadBalance
-- Returns:
- oracleConnectionBuilder
-
connectTimeout
OracleConnectionStringBuilder connectTimeout(int connectTimeout)
Used to configure the value of CONNECT_TIMEOUT in the DESCRIPTION node. This is the maximum time allowed for establishing the connection to the Oracle Database.The value is in seconds.- Parameters:
connectTimeout
-- Returns:
- oracleConnectionBuilder
-
transportConnectTimeout
OracleConnectionStringBuilder transportConnectTimeout(int transportConnectTimeout)
Used to configure the value of TRANSPORT_CONNECT_TIMEOUT in the DESCRIPTION node. The TRANSPORT_CONNECT_TIMEOUT parameter specifies the time, in seconds, for a client to establish a TCP connection to the Oracle Database Server.- Parameters:
transportConnectTimeout
-- Returns:
- oracleConnectionBuilder
-
retryCount
OracleConnectionStringBuilder retryCount(int retryCount)
Used to configure the value of RETRY_COUNT in the DESCRIPTION node.- Parameters:
retryCount
-- Returns:
- oracleConnectionBuilder
-
retryDelay
OracleConnectionStringBuilder retryDelay(int retryDelay)
Used to configure the value of RETRY_DELAY in the DESCRIPTION node.- Parameters:
retryDelay
-- Returns:
- oracleConnectionBuilder
-
build
String build() throws IllegalStateException
Builds the TNS ConnectString using the provided values and returns the built value. ThrowsIllegalStateException
if any of values provided for building the connect string is invalid.- Returns:
- tnsConnectString
- Throws:
IllegalStateException
-
buildThinStyleURL
String buildThinStyleURL() throws IllegalStateException
It works the same way asbuild()
, but It adds the prefix required by the JDBC Thin Driver to resolve the driver type.- Returns:
- tnsConnectString
- Throws:
IllegalStateException
-
-