Class EmbedXAConnection

    • Constructor Detail

      • EmbedXAConnection

        EmbedXAConnection​(BasicEmbeddedDataSource40 ds,
                          ResourceAdapter ra,
                          java.lang.String u,
                          java.lang.String p,
                          boolean requestPassword)
                   throws java.sql.SQLException
        Throws:
        java.sql.SQLException
    • Method Detail

      • isGlobal

        private boolean isGlobal()
        Check if this connection is part of a global XA transaction.
        Returns:
        true if the transaction is global, false if the transaction is local
      • getXAResource

        public final javax.transaction.xa.XAResource getXAResource()
                                                            throws java.sql.SQLException
        Specified by:
        getXAResource in interface javax.sql.XAConnection
        Throws:
        java.sql.SQLException
      • checkHoldCursors

        public int checkHoldCursors​(int holdability,
                                    boolean downgrade)
                             throws java.sql.SQLException
        Are held cursors allowed. If the connection is attached to a global transaction then downgrade the result set holdabilty to CLOSE_CURSORS_AT_COMMIT if downgrade is true, otherwise throw an exception. If the connection is in a local transaction then the passed in holdabilty is returned.
        Specified by:
        checkHoldCursors in interface BrokeredConnectionControl
        Overrides:
        checkHoldCursors in class EmbedPooledConnection
        downgrade - true to downgrade the holdability, false to throw an exception.
        Throws:
        java.sql.SQLException
      • getConnection

        public java.sql.Connection getConnection()
                                          throws java.sql.SQLException
        Description copied from class: EmbedPooledConnection
        Create an object handle for a database connection.
        Specified by:
        getConnection in interface javax.sql.PooledConnection
        Overrides:
        getConnection in class EmbedPooledConnection
        Returns:
        a Connection object
        Throws:
        java.sql.SQLException - - if a database-access error occurs.
      • wrapStatement

        public java.sql.PreparedStatement wrapStatement​(java.sql.PreparedStatement ps,
                                                        java.lang.String sql,
                                                        java.lang.Object generatedKeys)
                                                 throws java.sql.SQLException
        Wrap and control a PreparedStatement
        Specified by:
        wrapStatement in interface BrokeredConnectionControl
        Overrides:
        wrapStatement in class EmbedPooledConnection
        Parameters:
        ps - PreparedStatment to be wrapped
        sql - String
        generatedKeys - Object
        Returns:
        returns the wrapped PreparedStatement
        Throws:
        java.sql.SQLException
      • wrapStatement

        public java.sql.CallableStatement wrapStatement​(java.sql.CallableStatement cs,
                                                        java.lang.String sql)
                                                 throws java.sql.SQLException
        Wrap and control a PreparedStatement
        Specified by:
        wrapStatement in interface BrokeredConnectionControl
        Overrides:
        wrapStatement in class EmbedPooledConnection
        Parameters:
        cs - CallableStatment to be wrapped
        sql - String
        Returns:
        returns the wrapped CallableStatement
        Throws:
        java.sql.SQLException
      • getRealConnection

        public EngineConnection getRealConnection()
                                           throws java.sql.SQLException
        Override getRealConnection to create a a local connection when we are not associated with an XA transaction. This can occur if the application has a Connection object (conn) and the following sequence occurs. conn = xac.getConnection(); xac.start(xid, ...) // do work with conn xac.end(xid, ...); // do local work with conn // need to create new connection here.
        Specified by:
        getRealConnection in interface BrokeredConnectionControl
        Overrides:
        getRealConnection in class EmbedPooledConnection
        Throws:
        java.sql.SQLException