Re: getTables() doesn't handle umlauts correctly

From: dmp <danap(at)ttc-cmc(dot)net>
To: Thomas Kellerer <spam_eater(at)gmx(dot)net>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: getTables() doesn't handle umlauts correctly
Date: 2010-11-22 18:54:30
Message-ID: 4CEABC66.2010201@ttc-cmc.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

I also tried the table creation in the MyJSQLView app. which
uses the jdbc, this morning and I just don't see it. The correct
table name is showing up in the public schema and also in the
information_schema.tables as shown by the app.

I also tested the code directly and again the correct table
name is showing up. The only thing different is not on XP, but
with the same server and jdbc versions.

Now you may wish to try just % or null for the tableNamePattern.
Perhaps something is going on with parsing of that parameter.
The API indicates that "a table name pattern; must match the
table name as it is stored in the database"

danap

> Hi,
>
> I noticed that the driver will return incorrect values for table names that contain umlauts. Consider the following code:
>
> Class.forName("org.postgresql.Driver");
> con = DriverManager.getConnection("jdbc:postgresql://localhost/postgres", "postgres", "password");
> stmt = con.createStatement();
> stmt.executeUpdate("create table public.umlaut_test_ö (id integer)");
> rs = con.getMetaData().getTables(null, "public", "umlaut_test%", null);
> while (rs.next())
> {
> System.out.println(rs.getString("TABLE_NAME"));
> }
>
> It will not display the table name correctly.
>
> Now on the console this might be an encoding problem of the client, but the name is also not displayed correctly, when e.g. using a Swing JLabel component which is fully UTF-8 compatible.
>
> Is there a connection parameter for the driver to return that correctly or is this a driver bug?
>
> I'm using the 9.0-801 driver with a 9.0.1 database running on Windows XP
>
> Regards
> Thomas

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Thomas Kellerer 2010-11-22 18:59:26 Re: getTables() doesn't handle umlauts correctly
Previous Message Maciek Sakrejda 2010-11-22 18:52:04 Re: Insert null in int column