You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by ti...@apache.org on 2010/10/05 00:22:03 UTC

svn commit: r1004460 - in /db/derby/code/trunk/java: client/org/apache/derby/client/net/ testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/

Author: tiago
Date: Mon Oct  4 22:22:02 2010
New Revision: 1004460

URL: http://svn.apache.org/viewvc?rev=1004460&view=rev
Log:
DERBY-4757 (Client) Implement UTF8 support on DRDA

Committing the final patch that will put the UTF-8 support in place.

Also fixes current test fixtures and adds another one for boundary testing.

Modified:
    db/derby/code/trunk/java/client/org/apache/derby/client/net/CodePoint.java
    db/derby/code/trunk/java/client/org/apache/derby/client/net/NetAgent.java
    db/derby/code/trunk/java/client/org/apache/derby/client/net/NetConfiguration.java
    db/derby/code/trunk/java/client/org/apache/derby/client/net/NetConnection.java
    db/derby/code/trunk/java/client/org/apache/derby/client/net/NetConnectionReply.java
    db/derby/code/trunk/java/client/org/apache/derby/client/net/NetConnectionRequest.java
    db/derby/code/trunk/java/client/org/apache/derby/client/net/NetPackageRequest.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/AuthenticationTest.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/InternationalConnectTest.java

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/net/CodePoint.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/net/CodePoint.java?rev=1004460&r1=1004459&r2=1004460&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/net/CodePoint.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/net/CodePoint.java Mon Oct  4 22:22:02 2010
@@ -252,6 +252,10 @@ public class CodePoint {
     // Agent codepoint constant.
     static final int AGENT = 0x1403;
 
+    // UNICODE Manager. Min. level 0.
+    // Provides character encoding of the DDM objects and parameters
+    static final int UNICODEMGR = 0x1C08;
+    
     // The codepoint for codepoint
     static final int CODPNT = 0x000C;
 

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/net/NetAgent.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/net/NetAgent.java?rev=1004460&r1=1004459&r2=1004460&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/net/NetAgent.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/net/NetAgent.java Mon Oct  4 22:22:02 2010
@@ -172,10 +172,8 @@ public class NetAgent extends Agent {
 
         ebcdicCcsidManager_ = new EbcdicCcsidManager();
         utf8CcsidManager_ = new Utf8CcsidManager();
-        currentCcsidManager_ = ebcdicCcsidManager_;
         
-        // TODO: Remove target? Keep just one ccsidManager?
-        //targetCcsidManager_ = sourceCcsidManager_; // delete these
+        currentCcsidManager_ = ebcdicCcsidManager_;
 
         if (netConnection_.isXAConnection()) {
             NetXAConnectionReply netXAConnectionReply_ = new NetXAConnectionReply(this, netConnection_.commBufferSize_);
@@ -509,6 +507,19 @@ public class NetAgent extends Agent {
         super.endReadChain();
     }
 
+    /**
+     * Switches the current CCSID manager to UTF-8
+     */
+    public void switchToUtf8CcsidMgr() {
+        currentCcsidManager_ = utf8CcsidManager_;
+    }
+    
+    /**
+     * Switches the current CCSID manager to EBCDIC
+     */
+    public void switchToEbcdicMgr() {
+        currentCcsidManager_ = ebcdicCcsidManager_;
+    }
 
     public String convertToStringTcpIpAddress(int tcpIpAddress) {
         StringBuffer ipAddrBytes = new StringBuffer();

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/net/NetConfiguration.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/net/NetConfiguration.java?rev=1004460&r1=1004459&r2=1004460&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/net/NetConfiguration.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/net/NetConfiguration.java Mon Oct  4 22:22:02 2010
@@ -71,6 +71,9 @@ public class NetConfiguration {
     // Minimum sqlam manager level required by protocol.
     static final int MIN_RSYNCMGR_MGRLVL = 5;
 
+    // Minimum unicodemgr manager level required by protocol
+    static final int MIN_UNICODE_MGRLVL = 0;
+    
     // Maximun Password size.
     static final int PASSWORD_MAXSIZE = 255;
 

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/net/NetConnection.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/net/NetConnection.java?rev=1004460&r1=1004459&r2=1004460&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/net/NetConnection.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/net/NetConnection.java Mon Oct  4 22:22:02 2010
@@ -80,7 +80,7 @@ public class NetConnection extends org.a
     protected int targetXamgr_ = NetConfiguration.MGRLVL_7;
     protected int targetSyncptmgr_ = NetConfiguration.MGRLVL_NA;
     protected int targetRsyncmgr_ = NetConfiguration.MGRLVL_NA;
-
+    protected int targetUnicodemgr_ = CcsidManager.UTF8_CCSID;
 
     // this is the external name of the target server.
     // it is set by the parseExcsatrd method but not really used for much at this
@@ -709,7 +709,8 @@ public class NetConnection extends org.a
                 targetCmnappc_,
                 targetXamgr_,
                 targetSyncptmgr_,
-                targetRsyncmgr_);
+                targetRsyncmgr_,
+                targetUnicodemgr_);
         agent_.flowOutsideUOW();
         netAgent_.netConnectionReply_.readExchangeServerAttributes(this);
         agent_.endReadChain();
@@ -797,7 +798,8 @@ public class NetConnection extends org.a
                 targetCmnappc_,
                 targetXamgr_,
                 targetSyncptmgr_,
-                targetRsyncmgr_);
+                targetRsyncmgr_,
+                targetUnicodemgr_);
         netAgent_.netConnectionRequest_.writeAccessSecurity(securityMechanism,
                 databaseName_,
                 publicKey);
@@ -1348,14 +1350,6 @@ public class NetConnection extends org.a
                 netAgent_);
         prddtaLen += NetConfiguration.PRDDTA_APPL_ID_FIXED_LEN;
 
-        if (user_ != null) {
-            int userTruncateLength = Math.min(user_.length(), NetConfiguration.PRDDTA_USER_ID_FIXED_LEN);
-            netAgent_.getCurrentCcsidManager().convertFromJavaString(user_.substring(0, userTruncateLength),
-                    prddta_,
-                    prddtaLen,
-                    netAgent_);
-        }
-
         prddtaLen += NetConfiguration.PRDDTA_USER_ID_FIXED_LEN;
 
         prddta_[NetConfiguration.PRDDTA_ACCT_SUFFIX_LEN_BYTE] = 0;
@@ -1752,6 +1746,14 @@ public class NetConnection extends org.a
     }
 
     /**
+     * Check whether the server supports the UTF-8 Ccsid Manager
+     * @return true if the server supports the UTF-8 Ccsid Manager
+     */
+    protected final boolean serverSupportsUtf8Ccsid() {
+        return targetUnicodemgr_ == CcsidManager.UTF8_CCSID;
+    }
+    
+    /**
      * Check whether the server supports UDTs
      * @return true if UDTs are supported
      */

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/net/NetConnectionReply.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/net/NetConnectionReply.java?rev=1004460&r1=1004459&r2=1004460&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/net/NetConnectionReply.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/net/NetConnectionReply.java Mon Oct  4 22:22:02 2010
@@ -2072,6 +2072,13 @@ public class NetConnectionReply extends 
                 secmecList,
                 sectknReceived,
                 sectkn);
+        
+        /* Switch to UTF-8 or EBCDIC managers depending on what's supported */
+        if (netConnection.serverSupportsUtf8Ccsid()) {
+            netConnection.netAgent_.switchToUtf8CcsidMgr();
+        } else {
+            netConnection.netAgent_.switchToEbcdicMgr();
+        }
     }
 
     // Called by all the NET*Reply classes.
@@ -2287,7 +2294,13 @@ public class NetConnectionReply extends 
                 }
                 netConnection.targetSyncptmgr_ = managerLevel;
                 break;
-
+            case CodePoint.UNICODEMGR:
+                if ((managerLevel < NetConfiguration.MIN_UNICODE_MGRLVL) ||
+                        (managerLevel > netConnection.targetUnicodemgr_)) {
+                    doMgrlvlrmSemantics(managerCodePoint, managerLevel);
+                }
+                netConnection.targetUnicodemgr_ = managerLevel;
+                break;
             case CodePoint.RSYNCMGR:
                 if ((managerLevel != 0) &&
                         (managerLevel < NetConfiguration.MIN_RSYNCMGR_MGRLVL) ||

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/net/NetConnectionRequest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/net/NetConnectionRequest.java?rev=1004460&r1=1004459&r2=1004460&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/net/NetConnectionRequest.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/net/NetConnectionRequest.java Mon Oct  4 22:22:02 2010
@@ -43,7 +43,8 @@ public class NetConnectionRequest extend
                                        int targetCmnappc,
                                        int targetXamgr,
                                        int targetSyncptmgr,
-                                       int targetRsyncmgr) throws SqlException {
+                                       int targetRsyncmgr,
+                                       int targetUnicodemgr) throws SqlException {
         // send the exchange server attributes command to the server.
         // no other commands will be chained to the excsat because
         // the manager levels are needed before anything else is attempted.
@@ -56,7 +57,8 @@ public class NetConnectionRequest extend
                 targetCmnappc,
                 targetXamgr,
                 targetSyncptmgr,
-                targetRsyncmgr);
+                targetRsyncmgr,
+                targetUnicodemgr);
 
     }
 
@@ -210,7 +212,8 @@ public class NetConnectionRequest extend
                      int targetCmnappc,
                      int targetXamgr,
                      int targetSyncptmgr,
-                     int targetRsyncmgr) throws SqlException {
+                     int targetRsyncmgr,
+                     int targetUnicodemgr) throws SqlException {
         createCommand();
 
         // begin excsat collection by placing the 4 byte llcp in the buffer.
@@ -247,7 +250,8 @@ public class NetConnectionRequest extend
                 targetSecmgr,
                 targetXamgr,
                 targetSyncptmgr,
-                targetRsyncmgr);
+                targetRsyncmgr,
+                targetUnicodemgr);
 
 
         // place the server class name into the buffer.
@@ -355,7 +359,7 @@ public class NetConnectionRequest extend
         // support.  the size will have ben previously checked so at this point just
         // write the data and pad with the correct number of bytes as needed.
         // this instance variable is always required.
-        buildRDBNAM(rdbnam,false);
+        buildRDBNAM(rdbnam,true);
 
         // the rdb access manager class specifies an instance of the SQLAM
         // that accesses the RDB.  the sqlam manager class codepoint
@@ -583,7 +587,8 @@ public class NetConnectionRequest extend
                                int secmgr,
                                int xamgr,
                                int syncptmgr,
-                               int rsyncmgr) throws SqlException {
+                               int rsyncmgr,
+                               int unicodemgr) throws SqlException {
         markLengthBytes(CodePoint.MGRLVLLS);
 
         // place the managers and their levels in the buffer
@@ -591,7 +596,8 @@ public class NetConnectionRequest extend
         writeCodePoint4Bytes(CodePoint.SQLAM, sqlam);
         writeCodePoint4Bytes(CodePoint.RDB, rdb);
         writeCodePoint4Bytes(CodePoint.SECMGR, secmgr);
-
+        writeCodePoint4Bytes(CodePoint.UNICODEMGR, unicodemgr);
+        
         if (netAgent_.netConnection_.isXAConnection()) {
             if (xamgr != NetConfiguration.MGRLVL_NA) {
                 writeCodePoint4Bytes(CodePoint.XAMGR, xamgr);

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/net/NetPackageRequest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/net/NetPackageRequest.java?rev=1004460&r1=1004459&r2=1004460&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/net/NetPackageRequest.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/net/NetPackageRequest.java Mon Oct  4 22:22:02 2010
@@ -91,12 +91,14 @@ public class NetPackageRequest extends N
     }
 
     private void buildSCLDTA(String identifier, int minimumLength) throws SqlException {
-        if (identifier.length() <= minimumLength) {
+        int length = netAgent_.getCurrentCcsidManager().getByteLength(identifier);
+        
+        if (length <= minimumLength) {
             write2Bytes(minimumLength);
             writeScalarPaddedString(identifier, minimumLength);
         } else {
-            write2Bytes(identifier.length());
-            writeScalarPaddedString(identifier, identifier.length());
+            write2Bytes(length);
+            writeScalarPaddedString(identifier, length);
         }
     }
 
@@ -167,7 +169,7 @@ public class NetPackageRequest extends N
     private boolean checkPKGNAMlengths(String identifier,
                                        int maxIdentifierLength,
                                        int lengthRequiringScldta) throws SqlException {
-        int length = identifier.length();
+        int length = netAgent_.getCurrentCcsidManager().getByteLength(identifier);;
         if (length > maxIdentifierLength) {
             throw new SqlException(netAgent_.logWriter_,
                 new ClientMessageId(SQLState.LANG_IDENTIFIER_TOO_LONG),

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/AuthenticationTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/AuthenticationTest.java?rev=1004460&r1=1004459&r2=1004460&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/AuthenticationTest.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/AuthenticationTest.java Mon Oct  4 22:22:02 2010
@@ -1000,39 +1000,31 @@ public class AuthenticationTest extends 
         conn1.commit();
         conn1.close();
         
-        // with network server / derbynet client, non-ascii isn't supported,
-        // (or not working) see also DERBY-728, and
-        // org.apache.derby.client.net.EbcdicCcsidManager
-        if (usingDerbyNetClient())
-        {
-            assertConnectionFail("22005", dbName, zeus, apollo);
-        }
-        else {
-            assertConnectionOK(dbName, zeus, apollo);
-            assertConnectionFail("08004", dbName, apollo, apollo);
-            // shutdown as non-dbo
-            assertShutdownOK(dbName, zeus, apollo);
-            assertConnectionOK(dbName, apollo, zeus);
-            // wrong credentials
-            assertShutdownFail("08004", dbName, zeus, zeus);
-             // shutdown as non-dbo
-            assertShutdownOK(dbName, apollo, zeus);
-            assertConnectionOK(dbName, apollo, zeus);
-            // shutdown as dbo
-            assertShutdownUsingSetShutdownOK(
-                dbName, "APP", ("APP" + PASSWORD_SUFFIX));
-
-            conn1 = openDefaultConnection(zeus, apollo);
-            Statement stmt = conn1.createStatement();
-            assertUpdateCount(stmt, 0, 
-            "create table APP.t1(c1 varchar(30))");
-            assertUpdateCount(stmt, 1, "insert into APP.t1 values USER");
-            conn1.commit();
-            assertUserValue(new String[] {zeus}, zeus, apollo,
-            "select * from APP.t1 where c1 like CURRENT_USER");
-            stmt.close();
-            conn1.close();
-        }
+
+        assertConnectionOK(dbName, zeus, apollo);
+        assertConnectionFail("08004", dbName, apollo, apollo);
+        // shutdown as non-dbo
+        assertShutdownOK(dbName, zeus, apollo);
+        assertConnectionOK(dbName, apollo, zeus);
+        // wrong credentials
+        assertShutdownFail("08004", dbName, zeus, zeus);
+         // shutdown as non-dbo
+        assertShutdownOK(dbName, apollo, zeus);
+        assertConnectionOK(dbName, apollo, zeus);
+        // shutdown as dbo
+        assertShutdownUsingSetShutdownOK(
+            dbName, "APP", ("APP" + PASSWORD_SUFFIX));
+
+        conn1 = openDefaultConnection(zeus, apollo);
+        Statement stmt = conn1.createStatement();
+        assertUpdateCount(stmt, 0, 
+        "create table APP.t1(c1 varchar(30))");
+        assertUpdateCount(stmt, 1, "insert into APP.t1 values USER");
+        conn1.commit();
+        assertUserValue(new String[] {zeus}, zeus, apollo,
+        "select * from APP.t1 where c1 like CURRENT_USER");
+        stmt.close();
+        conn1.close();
         
         // reset
         conn1 = openDefaultConnection("dan", ("dan" + PASSWORD_SUFFIX));
@@ -1040,7 +1032,7 @@ public class AuthenticationTest extends 
             "derby.database.defaultConnectionMode","fullAccess", conn1);
         setDatabaseProperty(
             "derby.connection.requireAuthentication","false", conn1);
-        Statement stmt = conn1.createStatement();
+        stmt = conn1.createStatement();
         if (usingEmbedded())
             assertUpdateCount(stmt, 0, "drop table APP.t1");
         conn1.commit();

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/InternationalConnectTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/InternationalConnectTest.java?rev=1004460&r1=1004459&r2=1004460&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/InternationalConnectTest.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/InternationalConnectTest.java Mon Oct  4 22:22:02 2010
@@ -21,6 +21,7 @@
 package org.apache.derbyTesting.functionTests.tests.jdbcapi;
 
 import java.io.File;
+import java.io.UnsupportedEncodingException;
 import java.sql.Connection;
 import java.sql.DriverManager;
 import java.sql.SQLException;
@@ -31,11 +32,9 @@ import javax.sql.XAConnection;
 import javax.sql.XADataSource;
 
 import junit.framework.Test;
-import junit.framework.TestSuite;
 
 import org.apache.derbyTesting.junit.BaseJDBCTestCase;
 import org.apache.derbyTesting.junit.J2EEDataSource;
-import org.apache.derbyTesting.junit.JDBC;
 import org.apache.derbyTesting.junit.TestConfiguration;
 
 public class InternationalConnectTest extends BaseJDBCTestCase {
@@ -63,6 +62,52 @@ public class InternationalConnectTest ex
     
     }
 
+    public void testBoundaries() throws SQLException, UnsupportedEncodingException {
+        if (usingEmbedded()) return; /* This test is only for Client/Server */
+        
+        /* Maximum length in bytes is 255. We subtract 12 for ;create=true  */
+        int maxNameLength = 255 - 12;
+        
+        /**
+         * \u0041 is the letter 'A' (1 byte)
+         * \u00e7 is the letter 'c' with a cedilla (2 bytes)
+         * \u4310 is a Chinese character (3 bytes)
+         * \u1f030 is a domino tile (4 bytes)
+         */
+        String[] testCharacters = {"\u0041", "\u00e7", "\u4e10", "\u1f030"}; 
+        
+        for (int ch=0; ch<testCharacters.length; ch++) {
+            StringBuffer dbName = new StringBuffer();
+            
+            /* max length in bytes divided by length of 1 chinese char */ 
+            int maxChars = maxNameLength / testCharacters[ch].getBytes("UTF-8").length;
+            for(int i=0; i<maxChars; i++) {
+                dbName.append(testCharacters[ch]);
+            }
+            
+            /* This time it should work as we're right at the limit */
+            String url = TestConfiguration
+                    .getCurrent().getJDBCUrl(dbName.toString()+ ";create=true");
+            
+            Connection conn = DriverManager.getConnection(url);
+            conn.close();
+            
+            /* Append one more character to make it fail */
+            dbName.append(testCharacters[ch]);
+
+            url = TestConfiguration
+                    .getCurrent().getJDBCUrl(dbName.toString()+ ";create=true");
+
+            try {
+                conn = DriverManager.getConnection(url);
+                assertTrue("Used more characters than possible in database name",
+                        false);
+            } catch (SQLException e) {
+                assertSQLState("08001", e); /* Check if it failed */
+            }
+        }
+    }
+    
     /**
      * Test Chinese character in database name, user and password, using 
      * DriverManager methods.
@@ -74,63 +119,32 @@ public class InternationalConnectTest ex
         getConnection();
         Connection conn = null;
         String url = null;
-        try {
-            //Test Chinese database name
-            url = TestConfiguration.getCurrent().getJDBCUrl("\u4e10;create=true");
-            
-            conn = DriverManager.getConnection(url);
-            conn.close();
-        } catch (SQLException se) {
-            if (usingEmbedded())
-                throw se;
-            else
-                assertSQLState("22005",se);
-        }            
-        try {
-            // Test Chinese user name
-            url = TestConfiguration.getCurrent().getJDBCUrl("\u4e10;user=\u4e10");
-            conn = DriverManager.getConnection(url);
-            conn.close();
-        } catch (SQLException se ){
-            if (usingEmbedded())
-                throw se;
-            else
-                assertSQLState("22005",se);
-        }
-        try {
-            // Test Chinese user name in parameter to getConnection
-            url = TestConfiguration.getCurrent().getJDBCUrl("\u4e10");
-            conn = DriverManager.getConnection(url,"\u4e10","pass");
-            conn.close();
-        } catch (SQLException se ) {
-            if (usingEmbedded())
-                throw se;
-            else
-                assertSQLState("22005",se);
-        }
-        try {
-            // Test Chinese password in url
-            url = TestConfiguration.getCurrent().getJDBCUrl("\u4e10;user=user;password=\u4e10");
-            conn = DriverManager.getConnection(url);
-            conn.close();
-        } catch (SQLException se ){
-            if (usingEmbedded())
-                throw se;
-            else
-                assertSQLState("22005",se);
-        }
-        try {
-            // Test Chinese password in parameter to getConnection()
-            url = TestConfiguration.getCurrent().getJDBCUrl("\u4e10");
-            conn = DriverManager.getConnection(url,"\u4e10","\u4e10");
-            conn.close();
-        } catch (SQLException se ) {
-            if (usingEmbedded())
-                throw se;
-            else
-                assertSQLState("22005",se);
-        }
-       
+
+        //Test Chinese database name
+        url = TestConfiguration.getCurrent().getJDBCUrl("\u4e10;create=true");
+        
+        conn = DriverManager.getConnection(url);
+        conn.close();           
+
+        // Test Chinese user name
+        url = TestConfiguration.getCurrent().getJDBCUrl("\u4e10;user=\u4e10");
+        conn = DriverManager.getConnection(url);
+        conn.close();
+
+        // Test Chinese user name in parameter to getConnection
+        url = TestConfiguration.getCurrent().getJDBCUrl("\u4e10");
+        conn = DriverManager.getConnection(url,"\u4e10","pass");
+        conn.close();
+
+        // Test Chinese password in url
+        url = TestConfiguration.getCurrent().getJDBCUrl("\u4e10;user=user;password=\u4e10");
+        conn = DriverManager.getConnection(url);
+        conn.close();
+
+        // Test Chinese password in parameter to getConnection()
+        url = TestConfiguration.getCurrent().getJDBCUrl("\u4e10");
+        conn = DriverManager.getConnection(url,"\u4e10","\u4e10");
+        conn.close();
     }
     
     
@@ -143,40 +157,22 @@ public class InternationalConnectTest ex
         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);
-        }   
+
+        XAConnection xaconn = ds.getXAConnection();
+        Connection conn = xaconn.getConnection();
+        conn.close();
+  
         // 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);
-        } 
+        J2EEDataSource.setBeanProperty(ds, "user", "\u4e10");
+        xaconn = ds.getXAConnection();
+        conn = xaconn.getConnection();
+        conn.close();
+
         // 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);
-        } 
+        J2EEDataSource.setBeanProperty(ds, "password", "\u4e10");
+        xaconn = ds.getXAConnection();
+        conn = xaconn.getConnection();
+        conn.close();
     }
     
     
@@ -189,40 +185,22 @@ public class InternationalConnectTest ex
         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);
-        }   
+
+        PooledConnection poolConn = ds.getPooledConnection();
+        Connection conn = poolConn.getConnection();
+        conn.close();
+ 
         // 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);
-        } 
+        J2EEDataSource.setBeanProperty(ds, "user", "\u4e10");
+        poolConn = ds.getPooledConnection();
+        conn = poolConn.getConnection();
+        conn.close();
+
         // 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);
-        } 
+        J2EEDataSource.setBeanProperty(ds, "password", "\u4e10");
+        poolConn= ds.getPooledConnection();
+        conn = poolConn.getConnection();
+        conn.close();
     }
 
     /**