Package oracle.jdbc

## Interface OracleConnectionStringBuilder

    public interface OracleConnectionStringBuilder

Since:
  20c

### Nested Class Summary

Nested Classes
`static class` `OracleConnectionStringBuilder.ConnectInfo` This class represents the ADDRESS node of the TNS Connect String.

### Field Summary

Fields
`static java.lang.String` `PROTOCOL_TCP`
`static java.lang.String` `PROTOCOL_TCPS`
`static java.lang.String` `PROTOCOL_WSS`
`static java.lang.String` `SERVER_MODE_DEDICATED`
`static java.lang.String` `SERVER_MODE_POOLED`
`static java.lang.String` `SERVER_MODE_SHARED`

### Method Summary

All Methods Static Methods Instance Methods Abstract Methods
`OracleConnectionStringBuilder` `addConnectInfo​(java.lang.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.
`java.lang.String` `build()` Builds the TNS ConnectString using the provided values and returns the built value.
`java.lang.String` `buildThinStyleURL()` It works the same way as `build()`, 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​(java.lang.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​(java.lang.String serverDN)` Used to configure the value of SSL_SERVER_CERT_DN in the SECURITY node.
`OracleConnectionStringBuilder` `serverMode​(java.lang.String serverMode)` Used to configure the value of SERVER in the CONNECT_DATA node.
`OracleConnectionStringBuilder` `serviceName​(java.lang.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​(java.lang.String walletDirectory)` Used to configure the value of MY_WALLET_DIRECTORY in the SECURITY node.

### Field Detail

#### SERVER_MODE_DEDICATED

    static final java.lang.String SERVER_MODE_DEDICATED

See Also:
  Constant Field Values

#### SERVER_MODE_SHARED

    static final java.lang.String SERVER_MODE_SHARED

See Also:
  Constant Field Values

#### SERVER_MODE_POOLED

    static final java.lang.String SERVER_MODE_POOLED

See Also:
  Constant Field Values

#### PROTOCOL_TCP

    static final java.lang.String PROTOCOL_TCP

See Also:
  Constant Field Values

#### PROTOCOL_TCPS

    static final java.lang.String PROTOCOL_TCPS

See Also:
  Constant Field Values

#### PROTOCOL_WSS

    static final java.lang.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​(java.lang.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 use `addConnectInfo(ConnectInfo)`.

Parameters:
  `host` -
  `port` -
Returns:
  oracleConnectionBuilder

#### serviceName

    OracleConnectionStringBuilder serviceName​(java.lang.String serviceName)

Used to configure the value of SERVICE_NAME of the CONNECT_DATA node.

Parameters:
  `serviceName` -
Returns:
  oracleConnectionBuilder

#### serverMode

    OracleConnectionStringBuilder serverMode​(java.lang.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​(java.lang.String instanceName)

Used to configure the value of INSTANCE_NAME in the CONNECT_DATA node.

Parameters:
  `instanceName` -
Returns:
  oracleConnectionBuilder

#### serverDN

    OracleConnectionStringBuilder serverDN​(java.lang.String serverDN)

Used to configure the value of SSL_SERVER_CERT_DN in the SECURITY node. Configured value will be 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​(java.lang.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

    java.lang.String build()
                    throws java.lang.IllegalStateException

Builds the TNS ConnectString using the provided values and returns the built value. Throws `IllegalStateException` if any of values provided for building the connect string is invalid.

Returns:
  tnsConnectString
Throws:
  `java.lang.IllegalStateException`

#### buildThinStyleURL

    java.lang.String buildThinStyleURL()
                                throws java.lang.IllegalStateException

It works the same way as `build()`, but It adds the prefix required by the JDBC Thin Driver to resolve the driver type.

Returns:
  tnsConnectString
Throws:
  `java.lang.IllegalStateException`