org.apache.commons.dbcp2.managed

Class DataSourceXAConnectionFactory

  • java.lang.Object
    • org.apache.commons.dbcp2.managed.DataSourceXAConnectionFactory
    • Constructor Detail

      • DataSourceXAConnectionFactory

        public DataSourceXAConnectionFactory(TransactionManager transactionManager,
                                             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
      • DataSourceXAConnectionFactory

        public DataSourceXAConnectionFactory(TransactionManager transactionManager,
                                             XADataSource xaDataSource,
                                             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
      • DataSourceXAConnectionFactory

        public DataSourceXAConnectionFactory(TransactionManager transactionManager,
                                             XADataSource xaDataSource,
                                             String userName,
                                             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
    • Method Detail

      • getUsername

        public String getUsername()
        Gets the user name used to authenticate new connections.
        Returns:
        the user name or null if unauthenticated connections are used
      • setUsername

        public void setUsername(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
      • setPassword

        public 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
      • setPassword

        public void setPassword(String userPassword)
        Sets the password used to authenticate new connections.
        Parameters:
        userPassword - the password used for authenticating the connection or null for unauthenticated

Copyright © 2001–2018 The Apache Software Foundation. All rights reserved.