Class DataSourceXAConnectionFactory
- java.lang.Object
- 
- org.apache.tomcat.dbcp.dbcp2.managed.DataSourceXAConnectionFactory
 
- 
- All Implemented Interfaces:
- ConnectionFactory,- XAConnectionFactory
 
 public class DataSourceXAConnectionFactory extends java.lang.Object implements XAConnectionFactory An implementation of XAConnectionFactory which uses a real XADataSource to obtain connections and XAResources.- Since:
- 2.0
 
- 
- 
Constructor SummaryConstructors Constructor Description DataSourceXAConnectionFactory(TransactionManager transactionManager, javax.sql.XADataSource xaDataSource)Creates an DataSourceXAConnectionFactory which uses the specified XADataSource to create database connections.DataSourceXAConnectionFactory(TransactionManager transactionManager, javax.sql.XADataSource xaDataSource, java.lang.String userName, char[] userPassword)Creates an DataSourceXAConnectionFactory which uses the specified XADataSource to create database connections.DataSourceXAConnectionFactory(TransactionManager transactionManager, javax.sql.XADataSource xaDataSource, java.lang.String userName, char[] userPassword, TransactionSynchronizationRegistry transactionSynchronizationRegistry)Creates an DataSourceXAConnectionFactory which uses the specified XADataSource to create database connections.DataSourceXAConnectionFactory(TransactionManager transactionManager, javax.sql.XADataSource xaDataSource, java.lang.String userName, java.lang.String userPassword)Creates an DataSourceXAConnectionFactory which uses the specified XADataSource to create database connections.DataSourceXAConnectionFactory(TransactionManager transactionManager, javax.sql.XADataSource xaDataSource, TransactionSynchronizationRegistry transactionSynchronizationRegistry)Creates an DataSourceXAConnectionFactory which uses the specified XADataSource to create database connections.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description java.sql.ConnectioncreateConnection()Create a newConnectionin an implementation specific fashion.TransactionRegistrygetTransactionRegistry()Gets the TransactionRegistry for this connection factory which contains a the XAResource for every connection created by this factory.java.lang.StringgetUsername()Deprecated.UsegetUserName().java.lang.StringgetUserName()Gets the user name used to authenticate new connections.char[]getUserPassword()Gets the user password.javax.sql.XADataSourcegetXaDataSource()Gets the XA data source.voidsetPassword(char[] userPassword)Sets the password used to authenticate new connections.voidsetPassword(java.lang.String userPassword)Sets the password used to authenticate new connections.voidsetUsername(java.lang.String userName)Sets the user name used to authenticate new connections.
 
- 
- 
- 
Constructor Detail- 
DataSourceXAConnectionFactorypublic DataSourceXAConnectionFactory(TransactionManager transactionManager, javax.sql.XADataSource xaDataSource) Creates an DataSourceXAConnectionFactory which uses the specified XADataSource to create database connections. The connections are enlisted into transactions using the specified transaction manager.- Parameters:
- transactionManager- the transaction manager in which connections will be enlisted
- xaDataSource- the data source from which connections will be retrieved
- Since:
- 2.6.0
 
 - 
DataSourceXAConnectionFactorypublic DataSourceXAConnectionFactory(TransactionManager transactionManager, javax.sql.XADataSource xaDataSource, java.lang.String userName, char[] userPassword) Creates an DataSourceXAConnectionFactory which uses the specified XADataSource to create database connections. The connections are enlisted into transactions using the specified transaction manager.- Parameters:
- transactionManager- the transaction manager in which connections will be enlisted
- xaDataSource- the data source from which connections will be retrieved
- userName- the user name used for authenticating new connections or null for unauthenticated
- userPassword- the password used for authenticating new connections
 
 - 
DataSourceXAConnectionFactorypublic DataSourceXAConnectionFactory(TransactionManager transactionManager, javax.sql.XADataSource xaDataSource, java.lang.String userName, char[] userPassword, TransactionSynchronizationRegistry transactionSynchronizationRegistry) Creates an DataSourceXAConnectionFactory which uses the specified XADataSource to create database connections. The connections are enlisted into transactions using the specified transaction manager.- Parameters:
- transactionManager- the transaction manager in which connections will be enlisted
- xaDataSource- the data source from which connections will be retrieved
- userName- the user name used for authenticating new connections or null for unauthenticated
- userPassword- the password used for authenticating new connections
- transactionSynchronizationRegistry- register with this TransactionSynchronizationRegistry
- Since:
- 2.6.0
 
 - 
DataSourceXAConnectionFactorypublic DataSourceXAConnectionFactory(TransactionManager transactionManager, javax.sql.XADataSource xaDataSource, java.lang.String userName, java.lang.String userPassword) Creates an DataSourceXAConnectionFactory which uses the specified XADataSource to create database connections. The connections are enlisted into transactions using the specified transaction manager.- Parameters:
- transactionManager- the transaction manager in which connections will be enlisted
- xaDataSource- the data source from which connections will be retrieved
- userName- the user name used for authenticating new connections or null for unauthenticated
- userPassword- the password used for authenticating new connections
 
 - 
DataSourceXAConnectionFactorypublic DataSourceXAConnectionFactory(TransactionManager transactionManager, javax.sql.XADataSource xaDataSource, TransactionSynchronizationRegistry transactionSynchronizationRegistry) Creates an DataSourceXAConnectionFactory which uses the specified XADataSource to create database connections. The connections are enlisted into transactions using the specified transaction manager.- Parameters:
- transactionManager- the transaction manager in which connections will be enlisted
- xaDataSource- the data source from which connections will be retrieved
- transactionSynchronizationRegistry- register with this TransactionSynchronizationRegistry
 
 
- 
 - 
Method Detail- 
createConnectionpublic java.sql.Connection createConnection() throws java.sql.SQLExceptionDescription copied from interface:XAConnectionFactoryCreate a newConnectionin an implementation specific fashion.An implementation can assume that the caller of this will wrap the connection in a proxy that protects access to the setAutoCommit, commit and rollback when enrolled in a XA transaction. - Specified by:
- createConnectionin interface- ConnectionFactory
- Specified by:
- createConnectionin interface- XAConnectionFactory
- Returns:
- a new Connection
- Throws:
- java.sql.SQLException- if a database error occurs creating the connection
 
 - 
getTransactionRegistrypublic TransactionRegistry getTransactionRegistry() Description copied from interface:XAConnectionFactoryGets the TransactionRegistry for this connection factory which contains a the XAResource for every connection created by this factory.- Specified by:
- getTransactionRegistryin interface- XAConnectionFactory
- Returns:
- the transaction registry for this connection factory
 
 - 
getUsername@Deprecated public java.lang.String getUsername() Deprecated.UsegetUserName().Gets the user name used to authenticate new connections.- Returns:
- the user name or null if unauthenticated connections are used
 
 - 
getUserNamepublic java.lang.String getUserName() Gets the user name used to authenticate new connections.- Returns:
- the user name or null if unauthenticated connections are used
- Since:
- 2.6.0
 
 - 
getUserPasswordpublic char[] getUserPassword() Gets the user password.- Returns:
- the user password.
 
 - 
getXaDataSourcepublic javax.sql.XADataSource getXaDataSource() Gets the XA data source.- Returns:
- the XA data source.
 
 - 
setPasswordpublic void setPassword(char[] userPassword) Sets the password used to authenticate new connections.- Parameters:
- userPassword- the password used for authenticating the connection or null for unauthenticated.
- Since:
- 2.4.0
 
 - 
setPasswordpublic void setPassword(java.lang.String userPassword) Sets the password used to authenticate new connections.- Parameters:
- userPassword- the password used for authenticating the connection or null for unauthenticated
 
 - 
setUsernamepublic void setUsername(java.lang.String userName) Sets the user name used to authenticate new connections.- Parameters:
- userName- the user name used for authenticating the connection or null for unauthenticated
 
 
- 
 
-