Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 27DC39FC024 for ; Tue, 23 Oct 2007 12:16:46 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 65311-03 for ; Tue, 23 Oct 2007 12:16:41 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from kuber.nabble.com (kuber.nabble.com [216.139.236.158]) by postgresql.org (Postfix) with ESMTP id 26DBA9FC01E for ; Tue, 23 Oct 2007 12:16:41 -0300 (ADT) Received: from isper.nabble.com ([192.168.236.156]) by kuber.nabble.com with esmtp (Exim 4.63) (envelope-from ) id 1IkLUk-0001e0-1F for pgsql-jdbc@postgresql.org; Tue, 23 Oct 2007 08:16:38 -0700 Message-ID: <13366356.post@talk.nabble.com> Date: Tue, 23 Oct 2007 08:16:38 -0700 (PDT) From: =?UTF-8?Q?LiuYan_=E5=88=98=E7=A0=94?= To: pgsql-jdbc@postgresql.org Subject: Chinese database name in URL, can I ? MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Nabble-From: lovetide@21cn.com X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=1.947 tagged_above=0 required=5 tests=AWL=0.058, BAYES_20=-0.74, DNS_FROM_OPENWHOIS=1.13, WHOIS_MYPRIVREG=1.499 X-Spam-Level: * X-Archive-Number: 200710/121 X-Sequence-Number: 17693 I'm interesting in PostgreSQL these days, I created a database whose name contains Chinese characters, when I try to connect this database, I got an error: org.postgresql.util.PSQLException: FATAL: database "??pg???" does no= t exist=20 I'm using PostgreSQL 8.2.5 on Windows XP SP2 Simplified Chinese system, and using postgresql-8.2-506.jdbc4.jar as the jdbc driver. Here is my test Java program: ---------------------------------------------------------------------------= ----- <%@page pageEncoding=3D"gbk" contentType=3D"text/html" session=3D"false" import=3D"java.sql.*,java.util.*"%>

Chinese DatabaseName Test | =E4=B8=AD=E6=96=87=E6=95=B0=E6=8D=AE=E5=BA= =93=E5=90=8D=E6=B5=8B=E8=AF=95

<% String jdbcDriverName =3D "org.postgresql.Driver"; String jdbcURL=3D"jdbc:postgresql://localhost/=E4=B8=AD=E6=96=87pg=E6=95=B0=E6=8D= =AE=E5=BA=93?user=3Droot&password=3D123456"; String jdbcUserName =3D "root"; String jdbcPassword =3D "123456"; Connection con =3D null; Statement stmt =3D null; ResultSet rs =3D null; try { =09Class.forName (jdbcDriverName); =09con =3D DriverManager.getConnection (jdbcURL, jdbcUserName, jdbcPassword= ); =09stmt =3D con.createStatement (); =09rs =3D stmt.executeQuery("select version()"); =09ResultSetMetaData rsmd =3D rs.getMetaData (); =09while (rs.next()) =09{ =09=09out.println (rs.getString(1)); =09} =09rs.close(); =09stmt.close(); =09con.close (); }catch (Exception e) { =09out.println (e); } %> ---------------------------------------------------------------------------= ----- and the database environment: ---------------------------------------------------------------------------= ----- C:\>psql -U root postgres Welcome to psql 8.2.5, the PostgreSQL interactive terminal. Type: \copyright for distribution terms \h for help with SQL commands \? for help with psql commands \g or terminate with semicolon to execute query \q to quit postgres=3D# \l =E6=95=B0=E6=8D=AE=E5=BA=93=E5=88=97=E8=A1=A8 =E5=90=8D=E5=AD=97 | =E6=89=80=E6=9C=89=E8=80=85 | =E7=BC=96=E7= =A0=81 --------------+--------+----------- cntestdb | root | EUC_CN postgres | root | SQL_ASCII template0 | root | SQL_ASCII template1 | root | SQL_ASCII =E4=B8=AD=E6=96=87pg_utf8 | root | UTF8 =E4=B8=AD=E6=96=87pg=E6=95=B0=E6=8D=AE=E5=BA=93 | root | EUC_CN (6 rows) postgres=3D# \c =E4=B8=AD=E6=96=87pg=E6=95=B0=E6=8D=AE=E5=BA=93; You are now connected to database "=E4=B8=AD=E6=96=87pg=E6=95=B0=E6=8D=AE= =E5=BA=93". =E4=B8=AD=E6=96=87pg=E6=95=B0=E6=8D=AE=E5=BA=93=3D# \dt; =E5=85=B3=E7=B3=BB=E5=88=97=E8=A1=A8 =E6=A8=A1=E5=BC=8F | =E5=90=8D=E5=AD=97 | =E7=B1=BB=E5=9E=8B | = =E6=89=80=E6=9C=89=E8=80=85 --------+--------------+------+-------- public | serverregion | =E8=A1=A8 | root public | servers | =E8=A1=A8 | root public | =E4=B8=AD=E6=96=87=E8=A1=A8 | =E8=A1=A8 | root (3 rows) =E4=B8=AD=E6=96=87pg=E6=95=B0=E6=8D=AE=E5=BA=93=3D# select * from =E4=B8=AD= =E6=96=87=E8=A1=A8; =E5=AD=97=E6=AE=B51 | =E5=AD=97=E6=AE=B52 -------+------------ 1 | hello =E4=BD=A0=E5=A5=BD 2 | pg=E6=95=B0=E6=8D=AE=E5=BA=93 3 | =E7=94=A8jdbc=E8=AE=BF=E9=97=AE 4 | =E4=B8=AD=E6=96=87=E6=95=B0=E6=8D=AE=E5=BA=93 5 | =E5=8F=AF=E4=BB=A5=E5=90=97=EF=BC=9F (5 rows) =E4=B8=AD=E6=96=87pg=E6=95=B0=E6=8D=AE=E5=BA=93=3D# ---------------------------------------------------------------------------= ----- I've also tried add '&charSet=3DGBK' in the jdbcURL, and got the same resul= t. I know that MySQL can support Chinese database name in jdbc URL, so how can I use Chinese database name in jdbc URL to connect PostgreSQL? Thanks! --=20 View this message in context: http://www.nabble.com/Chinese-database-name-i= n-URL%2C-can-I---tf4678108.html#a13366356 Sent from the PostgreSQL - jdbc mailing list archive at Nabble.com.