Derby provides three embedded variants of each DataSource interface defined by the JDBC API.
Applications that run on the Java SE 5 platform must use the first variant. Applications that run on the Java SE 6 platform or higher (except Java SE 8 Compact Profiles) can use either of the first two variants. However, the DataSource methods specific to JDBC 4.1 and 4.2 are available only from the second and third variants (the ones whose class name ends with "40").
Applications that run on Java SE 8 Compact Profile 2 or 3 must use the third variant (the ones whose class name begins with "Basic"). Compact profiles do not support the Java Naming and Directory Interface (JNDI) API.
If an application is running on the Java SE 6 platform or higher, all connection objects returned from the DataSource will be JDBC 4 connection objects, regardless of which DataSource variant is in use.
The Derby implementation classes for the DataSource interfaces are as follows:
These classes implement the javax.sql.DataSource interface, which a JNDI server can reference (except in the case of the third variant). Typically, this is the object that you work with as a DataSource.
These classes implement the javax.sql.ConnectionPoolDataSource interface and provide a factory for PooledConnection objects.
These classes implement the javax.sql.XADataSource interface.
See the API documentation for each class for more information.