Top Description Fields Constructors Methods
org.apache.derby.jdbc

public Class EmbeddedXADataSource

extends EmbeddedDataSource
implements EmbeddedXADataSourceInterface
Class Inheritance
All Implemented Interfaces
org.apache.derby.iapi.jdbc.EmbeddedXADataSourceInterface, javax.sql.XADataSource, javax.sql.CommonDataSource, org.apache.derby.iapi.jdbc.EmbeddedDataSourceInterface, javax.sql.DataSource, java.sql.Wrapper
Known Direct Subclasses
org.apache.derby.jdbc.EmbeddedXADataSource40
Imports
java.sql.SQLException, javax.sql.XAConnection, org.apache.derby.iapi.jdbc.EmbeddedXADataSourceInterface, .ResourceAdapter, org.apache.derby.impl.jdbc.EmbedXAConnection

This data source is suitable for an application using embedded Derby, running on full Java SE 6 or higher, corresponding to JDBC 4.0 and higher. EmbeddedXADataSource is an XADataSource implementation.

An XADataSource is a factory for XAConnection objects. It represents a RM in a DTP environment. An object that implements the XADataSource interface is typically registered with a JNDI service provider.

EmbeddedXADataSource automatically supports the correct JDBC specification version for the Java Virtual Machine's environment.

Use BasicEmbeddedXADataSource40 if your application runs on Java 8 Compact Profile 2.

EmbeddedXADataSource object only works on a local database. There is no client/server support. An EmbeddedXADataSource object must live in the same jvm as the database.

EmbeddedXADataSource is serializable and referenceable.

See EmbeddedDataSource for DataSource properties.

Field Summary

Modifier and TypeField and Description
private transient ResourceAdapter
ra

A cached link to the database, set up with the first connection is made.

private static final long

Constructor Summary

AccessConstructor and Description
public
EmbeddedXADataSource()

no-arg constructor

Method Summary

Modifier and TypeMethod and Description
private XAConnection

Returns:

An XA connection to the database
createXAConnection
(ResourceAdapter
The resource adapter to the database
ra
,
String
The user name
user
,
String
The password
password
,
boolean
@false if original call is from a no-argument constructor, otherwise true
requestPassword
)

Instantiate and return an EmbedXAConnection from this instance of EmbeddedXADataSource.

public ResourceAdapter

Returns:

The cached ResourceAdapter instance for the underlying database
getResourceAdapter
()

Implements org.apache.derby.iapi.jdbc.EmbeddedXADataSourceInterface.getResourceAdapter.

public final XAConnection

Returns:

a Connection to the database
getXAConnection
()

Implements javax.sql.XADataSource.getXAConnection.

Attempt to establish a database connection.
public final XAConnection

Returns:

a Connection to the database
getXAConnection
(String
the database user on whose behalf the Connection is being made
user
,
String
the user's password
password
)

Implements javax.sql.XADataSource.getXAConnection.

Attempt to establish a database connection with the given user name and password.
protected void
Inherited from org.apache.derby.jdbc.EmbeddedDataSource:
getObjectInstancegetReference

Field Detail

raback to summary
private transient ResourceAdapter ra

A cached link to the database, set up with the first connection is made.

serialVersionUIDback to summary
private static final long serialVersionUID

Hides org.apache.derby.jdbc.EmbeddedDataSource.serialVersionUID.

Constructor Detail

EmbeddedXADataSourceback to summary
public EmbeddedXADataSource()

no-arg constructor

Method Detail

createXAConnectionback to summary
private XAConnection createXAConnection(ResourceAdapter ra, String user, String password, boolean requestPassword) throws SQLException

Instantiate and return an EmbedXAConnection from this instance of EmbeddedXADataSource.

Parameters
ra:ResourceAdapter

The resource adapter to the database

user:String

The user name

password:String

The password

requestPassword:boolean

@false if original call is from a no-argument constructor, otherwise true

Returns:XAConnection

An XA connection to the database

getResourceAdapterback to summary
public ResourceAdapter getResourceAdapter()

Implements org.apache.derby.iapi.jdbc.EmbeddedXADataSourceInterface.getResourceAdapter.

Returns:ResourceAdapter

The cached ResourceAdapter instance for the underlying database

Annotations
@Override
getXAConnectionback to summary
public final XAConnection getXAConnection() throws SQLException

Implements javax.sql.XADataSource.getXAConnection.

Attempt to establish a database connection.

Returns:XAConnection

a Connection to the database

Annotations
@Override
Exceptions
SQLException:
if a database-access error occurs.
getXAConnectionback to summary
public final XAConnection getXAConnection(String user, String password) throws SQLException

Implements javax.sql.XADataSource.getXAConnection.

Attempt to establish a database connection with the given user name and password.

Parameters
user:String

the database user on whose behalf the Connection is being made

password:String

the user's password

Returns:XAConnection

a Connection to the database

Annotations
@Override
Exceptions
SQLException:
if a database-access error occurs.
updateback to summary
protected void update()

Overrides org.apache.derby.jdbc.BasicEmbeddedDataSource40.update.

Doc from org.apache.derby.jdbc.BasicEmbeddedDataSource40.update.

Update jdbcurl from attributes set.

Also clear the cached value of ra.

Annotations
@Override