コード例 #1
0
 /**
  * Test pooled connetion for chinese database name, user and password.
  *
  * @throws SQLException
  */
 public void testCPDSConnect() throws SQLException {
   // Test chinese database name.
   ConnectionPoolDataSource ds = J2EEDataSource.getConnectionPoolDataSource();
   J2EEDataSource.setBeanProperty(ds, "databaseName", "\u4e10");
   J2EEDataSource.setBeanProperty(ds, "createDatabase", "create");
   try {
     PooledConnection poolConn = ds.getPooledConnection();
     Connection conn = poolConn.getConnection();
     conn.close();
   } catch (SQLException se) {
     if (usingEmbedded()) throw se;
     else assertSQLState("22005", se);
   }
   // Chinese user
   try {
     J2EEDataSource.setBeanProperty(ds, "user", "\u4e10");
     PooledConnection poolConn = ds.getPooledConnection();
     Connection conn = poolConn.getConnection();
     conn.close();
   } catch (SQLException se) {
     if (usingEmbedded()) throw se;
     else assertSQLState("22005", se);
   }
   // Chinese password
   try {
     J2EEDataSource.setBeanProperty(ds, "password", "\u4e10");
     PooledConnection poolConn = ds.getPooledConnection();
     Connection conn = poolConn.getConnection();
     conn.close();
   } catch (SQLException se) {
     if (usingEmbedded()) throw se;
     else assertSQLState("22005", se);
   }
 }
コード例 #2
0
  //
  // 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);
  }
コード例 #3
0
  //
  // Find all the objects inside the ConnectionPooledDataSource and vet them.
  //
  private void vetConnectionPooledDataSource(
      HashSet<String> unsupportedList, HashSet<String> notUnderstoodList) throws Exception {
    ConnectionPoolDataSource ds = J2EEDataSource.getConnectionPoolDataSource();
    PooledConnection pc =
        ds.getPooledConnection(
            getTestConfiguration().getUserName(), getTestConfiguration().getUserPassword());
    Connection conn = pc.getConnection();

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

    connectionWorkhorse(conn, unsupportedList, notUnderstoodList);
  }