Getting a DataSource

Normally, you can simply work with the interfaces for javax.sql.DataSource, javax.sql.ConnectionPoolDataSource, and javax.sql.XADataSource, as shown in the following examples.

// Note that if your application runs on JDK 1.6 or higher, you
// will use the JDBC4 variants of these classes:
//   org.apache.derby.jdbc.EmbeddedConnectionPoolDataSource40
//   org.apache.derby.jdbc.EmbeddedDataSource40
//   org.apache.derby.jdbc.EmbeddedXADataSource40
import org.apache.derby.jdbc.EmbeddedConnectionPoolDataSource;
import org.apache.derby.jdbc.EmbeddedDataSource;
import org.apache.derby.jdbc.EmbeddedXADataSource; 

javax.sql.ConnectionPoolDataSource cpds = new EmbeddedConnectionPoolDataSource(); 
javax.sql.DataSource ds = new EmbeddedDataSource(); 
javax.sql.XADataSource xads = new EmbeddedXADataSource();

Derby provides six properties for a DataSource. These properties are in org.apache.derby.jdbc.EmbeddedDataSource. They are:

Related concepts
Shutting down or creating a database
Related reference
Classes that pertain to resource managers