Connect to the database

These topics explain the information you need to use HCL OneDB™ JDBC Driver to connect to the HCL OneDB database.

You must first establish a connection to the HCL OneDB database server or database before you can start sending queries and receiving results in your Java™ program.

You establish a connection by completing two actions:
  1. Load .
  2. Create a connection to either a database server or a specific database in one of the following ways:
    • Use a DataSource object.
    • Use the DriverManager.getConnection() method.

Using a DataSource object is preferable to using the DriverManager.getConnection() method because a DataSource object is portable and allows the details about the underlying data source to be transparent to the application. The target data source implementation can be modified, or the application can be redirected to a different server without affecting the application code.

A DataSource object can also provide support for connection pooling and distributed transactions. In addition, Enterprise JavaBeans™ and J2EE require a DataSource object.

The following additional connection options are available:
  • Setting environment variables
  • Dynamically reading the HCL OneDB sqlhosts file
  • Using an HTTP proxy server
  • Using password encryption
  • Using network encryption