Connect to the database
These topics explain the information you need to use Informix® JDBC Driver to connect to the Informix® database.
You must first establish a connection to the Informix® database server or database before you can start sending queries and receiving results in your Java™ program.
- Load Informix® JDBC Driver.
- 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.
- Setting environment variables
- Dynamically reading the Informix® sqlhosts file
- Using an HTTP proxy server
- Using password encryption
- Using network encryption