|
9 | 9 | * Copyright (c) 2003, PostgreSQL Global Development Group |
10 | 10 | * |
11 | 11 | * IDENTIFICATION |
12 | | - * $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/Attic/AbstractJdbc1Connection.java,v 1.19 2003/05/29 03:21:32 barry Exp $ |
| 12 | + * $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/Attic/AbstractJdbc1Connection.java,v 1.20 2003/05/29 21:44:47 barry Exp $ |
13 | 13 | * |
14 | 14 | *------------------------------------------------------------------------- |
15 | 15 | */ |
@@ -770,15 +770,26 @@ private void openConnectionV2(String host, int port, Properties info, String dat |
770 | 770 |
|
771 | 771 | String dbEncoding = resultSet.getString(2); |
772 | 772 | encoding = Encoding.getEncoding(dbEncoding, info.getProperty("charSet")); |
| 773 | + |
| 774 | + //TODO: remove this once the set is done as part of V3protocol connection initiation |
| 775 | + if (haveMinimumServerVersion("7.4")) |
| 776 | + { |
| 777 | + BaseResultSet acRset = |
| 778 | + execSQL("set client_encoding = 'UNICODE'"); |
| 779 | + |
| 780 | + //set encoding to be unicode |
| 781 | + encoding = Encoding.getEncoding("UNICODE", null); |
| 782 | + } |
| 783 | + |
773 | 784 | //In 7.3 we are forced to do a second roundtrip to handle the case |
774 | 785 | //where a database may not be running in autocommit mode |
775 | 786 | //jdbc by default assumes autocommit is on until setAutoCommit(false) |
776 | 787 | //is called. Therefore we need to ensure a new connection is |
777 | 788 | //initialized to autocommit on. |
778 | 789 | //We also set the client encoding so that the driver only needs |
779 | | - //to deal with utf8. We can only do this in 7.3 because multibyte |
| 790 | + //to deal with utf8. We can only do this in 7.3+ because multibyte |
780 | 791 | //support is now always included |
781 | | - if (haveMinimumServerVersion("7.3")) |
| 792 | + if (haveMinimumServerVersion("7.3") && !haveMinimumServerVersion("7.4")) |
782 | 793 | { |
783 | 794 | BaseResultSet acRset = |
784 | 795 | execSQL("set client_encoding = 'UNICODE'; show autocommit"); |
|
0 commit comments