Configuring relational database connectivity in Liberty
You can configure a data source and JDBC provider for database connectivity. The JDBC provider supplies the driver implementation classes that are required for JDBC connectivity with your specific vendor database.
About this task
Kerberos authentication of data sources is supported for DB2®, Oracle Database, Microsoft SQL Server, and PostgreSQL.
Documentation for Kerberos authentication for JDBC data sources is available on the Open Liberty website.
Before version 20.0.0.11, Kerberos authentication for data sources is not supported for any JDBC drivers or databases in Liberty.
The Oracle JDBC thin driver, version 21c and earlier, supports only the Oracle JDK or OpenJDK Kerberos implementations. Therefore, these versions cannot be used with the IBM SDK, Java Technology Edition, Version 8. Update to version 21c or newer of the Oracle JDBC thin driver for support of Kerberos authentication for data sources with IBM Java™ 8.
To access a database from your application, application code must use the
javax.sql.DataSource
interface. The application server provides a managed
implementation of this javax.sql.DataSource
interface, which is backed by one of
the various data source or driver implementations that JDBC drivers provide. These data source or
driver implementations come in the following varieties:
javax.sql.DataSource
This type of data source is the basic form. It does not provide interoperability that enhances connection pooling, and cannot participate as a two-phase capable resource in transactions that involve multiple resources.
-
javax.sql.ConnectionPoolDataSource
This type of data source is enabled for connection pooling. It cannot participate as a two-phase capable resource in transactions that involve multiple resources.
-
javax.sql.XADataSource
This type of data source is both enabled for connection pooling and is able to participate as a two-phase capable resource in transactions that involve multiple resources.
java.sql.Driver
This is a basic way to connect that requires a URL and is typically used in Java SE. Like
javax.sql.DataSource
, it does not provide interoperability that enhances connection pooling, and cannot participate as a two-phase capable resource in transactions that involve multiple resources.
To be usable in Liberty, your JDBC driver
must provide at least one of these types of data sources or must provide a
java.sql.Driver
with the ServiceLoader
facility. For the commonly
used JDBC drivers, Liberty is already aware
of the implementation class names for the various data source types. Liberty uses the ServiceLoader
facility to discover JDBC driver implementations for a given URL. Based on the JDBC driver
implementation class, Liberty is often able
to infer the corresponding data source implementation class names. In most cases, you need to tell
Liberty only where to find the JDBC
driver.