/**
  * Test XA Connection for chinese database name, user and password.
  *
  * @throws SQLException
  */
 public void testXADSConnect() throws SQLException {
   // Test chinese database name.
   XADataSource ds = J2EEDataSource.getXADataSource();
   J2EEDataSource.setBeanProperty(ds, "databaseName", "\u4e10");
   J2EEDataSource.setBeanProperty(ds, "createDatabase", "create");
   try {
     XAConnection xaconn = ds.getXAConnection();
     Connection conn = xaconn.getConnection();
     conn.close();
   } catch (SQLException se) {
     if (usingEmbedded()) throw se;
     else assertSQLState("22005", se);
   }
   // Chinese user
   try {
     J2EEDataSource.setBeanProperty(ds, "user", "\u4e10");
     XAConnection xaconn = ds.getXAConnection();
     Connection conn = xaconn.getConnection();
     conn.close();
   } catch (SQLException se) {
     if (usingEmbedded()) throw se;
     else assertSQLState("22005", se);
   }
   // Chinese password
   try {
     J2EEDataSource.setBeanProperty(ds, "password", "\u4e10");
     XAConnection xaconn = ds.getXAConnection();
     Connection conn = xaconn.getConnection();
     conn.close();
   } catch (SQLException se) {
     if (usingEmbedded()) throw se;
     else assertSQLState("22005", se);
   }
 }
 protected void setUp() throws Exception {
   include(PATH);
   xads2_ = (XADataSource) getComponent("xads");
   xacon_ = xads2_.getXAConnection();
   con_ = xacon_.getConnection();
   xares_ = new DBXAResourceImpl(con_);
 }
  //
  // Find all the objects inside the XADataSource and vet them.
  //
  private void vetXADataSource(HashSet<String> unsupportedList, HashSet<String> notUnderstoodList)
      throws Exception {
    XADataSource ds = J2EEDataSource.getXADataSource();
    XAConnection xaconn =
        ds.getXAConnection(
            getTestConfiguration().getUserName(), getTestConfiguration().getUserPassword());
    Connection conn = xaconn.getConnection();

    vetObject(ds, unsupportedList, notUnderstoodList);
    vetObject(xaconn, unsupportedList, notUnderstoodList);

    connectionWorkhorse(conn, unsupportedList, notUnderstoodList);
  }
Example #4
0
 public XAConnection getXAConnection(String user, String password) throws SQLException {
   return wrap(_dataSource.getXAConnection(user, password));
 }
Example #5
0
 public XAConnection getXAConnection() throws SQLException {
   return wrap(_dataSource.getXAConnection());
 }