/** * 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); } }
// // 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); }