Open Source RDBMS - Seamless, Scalable, Stable and Free

한국어 | Login |Register

Versions available for this page: CUBRID 8.2.1 |  CUBRID 8.3.0 |  CUBRID 8.3.1 |  CUBRID 8.4.0 |  CUBRID 8.4.1 | 

Connection Configuration

The DriverManager is a basic interface for JDBC driver management and performs functions such as selecting a database driver and creating a new database connection. If the CUBRID JDBC driver is registered, database connection is made by calling the DriverManager.getConnection (db-url, user-id, and password) method. The getConnection method returns the Connection object, which is used for query and command executions and transaction commit or rollback. The parameter db-url, which is for connection configuration, is as follows:

jdbc:cubrid:<host>:<port>:<db-name>:[user-id]:[password]:[?<property> [& <property>]]


<host> ::=

hostname | ip_address


<property> ::=

althosts=<alternative_hosts> | rctime=<second> | connectTimeout=<second> | queryTimeout=<second> | charset=<character_set> | zeroDateTimeBehavior=<behavior_type> | logFile=<file_name> | logOnException=<bool_type> | logSlowQueries=<bool_type>&slowQueryThresholdMillis=<millisecond>


<alternative_hosts> ::=

<standby_broker1_host>:<port> [,<standby_broker2_host>:<port>]

<behavior_type> ::= exception | round | convertToNull

<bool_type> ::= true | false

  • <host> : IP address or host name where the CUBRID Broker is running
  • <port> : Broker port number (default : 33,000)
  • <db-name> : The name of the database to connect
  • [user-id] : The user that will be connected to the database. There are two users in the database by default: dba and public. If you enter an empty string (" "), you will connect to the database as a public user.
  • [password] : If there is no password set for the user, enter an empty string (" ").
  • althosts : One or more host IP of standby broker and connection port to be failed over in HA environment
  • rctime : Interval time (in seconds) to fail over an active server during system failure. For more information, see the example in "Administrator's Guide > CUBRID HA > Environment Configuration > JDBC Configuration."
  • connectTimeout : Configures timeout value for database connection in seconds (default value : 0). The DriverManger.setLoginTimeout() method can also be used to configure timeout value; however, if the value is configured in connection URL, configuration value specified as a method is ignored.
  • queryTimeout : Configures timeout value for query execution in seconds (default value : 0, infinite). This value can be changed by the DriverManger.setQueryTimeout method.
  • charset : Character set (charset) of database to be connected
  • zeroDateTimeBehavior : JDBC does not allow a value having 0 for both date and time regardless of date and time of the java.sql.Date type. This property (zeroDateTimeBehavior) is used to determine how to handle this value in case that it should be displayed. The default operation is exception. The each operation by configuration value is as follows:
    • exception : Default operation. It is hanlded as a SQLException exception.
    • round : Returns the minimum value.
    • convertToNull : Returns NULL.

    For information on the value having 0 for both date and time, see "CUBRID SQL Guide > Data Types > Date/Time Types > Definition and Characteristics."

  • logFile : Name of a log file for debugging (default value : cubrid_jdbc.log)
  • logOnException : Whether exception logging for debugging exists (default value : false)
  • logSlowQueries : Whether slow query logging for debugging exists (default value : false)
  • slowQueryThresholdMillis : Time out of a slow query for debugging (default value : 60,000 milliseconds)
Example 1

--connection URL string when user name and password omitted




--connection URL string when zeroDateTimeBehavior property specified



--connection URL string when charset property specified




--connection URL string when queryTimeout and charset property specified




--connection URL string when a property(althosts) specified for HA



--connection URL string when properties(althosts,rctime) specified for HA



--connection URL string when properties(althosts,rctime, charset) specified for HA


Example 2

String url = "jdbc:cubrid:";

String userid = "";

String password = "";


try {

   Connection conn =


   // Do something with the Connection




   } catch (SQLException e) {

       System.out.println("SQLException:" + e.getMessage());

       System.out.println("SQLState: " + e.getSQLState());




Because a colon (:) and a question mark (?) are used as a separator in URL string, it is not allowed to include them for password of URL string. To use them, you must specify a user name (user-id) and a password (password) as a separate parameter in the getConnection method.

Note The rollback method, which requests the transaction rollback, exits when the server completes the rollback job.