Package oracle.jdbc

Interface OracleConnectionStringBuilder


public interface OracleConnectionStringBuilder
Since:
20c
  • Field Details

  • Method Details

    • newInstance

      static OracleConnectionStringBuilder newInstance()
      Factory method for creating a new instance of OracleConnectionBuilder.
      Returns:
      oracleConnectionBuilder
    • addConnectInfo

      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 use addConnectInfo(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

      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(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

      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:
      IllegalStateException
    • buildThinStyleURL

      String buildThinStyleURL() throws 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:
      IllegalStateException