com.ibm.as400.access

Class AS400JDBCXADataSource

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, java.sql.Wrapper, javax.naming.Referenceable, javax.sql.CommonDataSource, javax.sql.DataSource, javax.sql.XADataSource


    public class AS400JDBCXADataSource
    extends AS400JDBCDataSource
    implements javax.sql.XADataSource
    The AS400JDBCXADataSource class represents a factory for AS400JDBCXAConnection objects.

    This support is only available when connecting to systems running OS/400 V5R1 or later, or IBM i.

    The following example creates an AS400JDBCXADataSource object and creates a connection to the database.

    // Create an XA data source for making the connection.
    AS400JDBCXADataSource xaDataSource = new AS400JDBCXADataSource("myAS400");
    xaDataSource.setUser("myUser");
    xaDataSource.setPassword("myPasswd");
    
    // Get the XAConnection.
    XAConnection xaConnection = xaDataSource.getXAConnection();
    
    See Also:
    AS400JDBCXAConnection, AS400JDBCXAResource, Serialized Form
    • Constructor Detail

      • AS400JDBCXADataSource

        public AS400JDBCXADataSource()
        Constructs a default AS400JDBCXADataSource object.
      • AS400JDBCXADataSource

        public AS400JDBCXADataSource(java.lang.String serverName)
        Constructs an AS400JDBCXADataSource with the specified serverName.
        Parameters:
        serverName - The name of the IBM i system.
      • AS400JDBCXADataSource

        public AS400JDBCXADataSource(java.lang.String serverName,
                             java.lang.String user,
                             java.lang.String password)
        Constructs an AS400JDBCXADataSource with the specified signon information.
        Parameters:
        serverName - The name of the IBM i system.
        user - The user id.
        password - The password.
      • AS400JDBCXADataSource

        public AS400JDBCXADataSource(java.lang.String serverName,
                             java.lang.String user,
                             char[] password)
        Constructs an AS400JDBCXADataSource with the specified signon information.
        Parameters:
        serverName - The name of the IBM i system.
        user - The user id.
        password - The password.
      • AS400JDBCXADataSource

        public AS400JDBCXADataSource(java.lang.String serverName,
                             java.lang.String user,
                             java.lang.String password,
                             java.lang.String keyRingNameX,
                             java.lang.String keyRingPasswordX)
        Deprecated. 
        Constructs an AS400JDBCXADataSource with the specified signon information to use for SSL communications with the IBM i system.
        Parameters:
        serverName - The name of the IBM i system.
        user - The user id.
        password - The password.
        keyRingNameX - Not used.
        keyRingPasswordX - Not used
    • Method Detail

      • getXAConnection

        public javax.sql.XAConnection getXAConnection()
                                               throws java.sql.SQLException
        Returns an XA connection to IBM i.
        Specified by:
        getXAConnection in interface javax.sql.XADataSource
        Returns:
        An XA connection.
        Throws:
        java.sql.SQLException - If a database error occurs.
      • getXAConnection

        public javax.sql.XAConnection getXAConnection(java.lang.String user,
                                             java.lang.String password)
                                               throws java.sql.SQLException
        Returns an XA connection to IBM i.
        Specified by:
        getXAConnection in interface javax.sql.XADataSource
        Parameters:
        user - The userid for the connection.
        password - The password for the connection.
        Returns:
        An XA connection.
        Throws:
        java.sql.SQLException - If a database error occurs.
      • getXAConnection

        public javax.sql.XAConnection getXAConnection(java.lang.String user,
                                             char[] password)
                                               throws java.sql.SQLException
        Returns an XA connection to IBM i.
        Parameters:
        user - The userid for the connection.
        password - The password for the connection.
        Returns:
        An XA connection.
        Throws:
        java.sql.SQLException - If a database error occurs.
      • getReference

        public javax.naming.Reference getReference()
                                            throws javax.naming.NamingException
        Returns the Reference object for the data source object. This is used by JNDI when bound in a JNDI naming service. Contains the information necessary to reconstruct the data source object when it is later retrieved from JNDI via an object factory.
        Specified by:
        getReference in interface javax.naming.Referenceable
        Overrides:
        getReference in class AS400JDBCDataSource
        Returns:
        A Reference object for the data source object.
        Throws:
        javax.naming.NamingException - If a naming error occurs resolving the object.