[pgsql-jp: 29938] 特定の日本語を含むとエラー

Ogino ogino @ sic.co.jp
2003年 5月 16日 (金) 19:29:14 JST


お世話になっています。荻野といいます。

今、PostgreSQL7.3.2+RedHat8.0+JDK1.4.1
でシステムを作っています。

以下のようなテーブルに、JDBC経由でアクセスすると
エラーを吐いて落ちてしまいます。

[テーブル:キーワード]
create table keyword(
	key_id integer,
	keyword varchar(100),
	kana varchar(100)
);

insert into keyword values(
	1,'睡眠時無呼吸症','すいみんじむこきゅうしょう');

select * from keyword 
	where keyword = '睡眠時無呼吸症' ;

エラーの内容は、以下の通りです。
The backend has broken the connection. Possibly the action you have attempted has caused it to close.
        at org.postgresql.PG_Stream.ReceiveChar(PG_Stream.java:140)
        at org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:76)
        at org.postgresql.jdbc1.AbstractJdbc1Connection.ExecSQL(AbstractJdbc1Connection.java:505)
        at org.postgresql.jdbc1.AbstractJdbc1Statement.execute(AbstractJdbc1Statement.java:320)
        at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:48)
        at org.postgresql.jdbc1.AbstractJdbc1Statement.executeQuery(AbstractJdbc1Statement.java:153)
        at org.postgresql.jdbc1.AbstractJdbc1Statement.executeQuery(AbstractJdbc1Statement.java:141)
        at org.apache.commons.dbcp.DelegatingStatement.executeQuery(DelegatingStatement.java:162)

これを見る限り、PG_Streamクラスで落ちているので、
このクラスを見たところ、以下のような記述がありました。

public int ReceiveChar() throws SQLException
{
	int c = 0;
	
	try
	{
	        c = pg_input.read();
	        if (c < 0)
	                throw new PSQLException("postgresql.stream.eof");
	}
	catch (IOException e)
	{
	        throw new PSQLException("postgresql.stream.ioerror", e);
	}
	return c;
}

簡単に言うと、Streamから何もデータを得られていない
様子です。しかし、同じテーブルに

insert into keyword values(2,'胃','い');

と入力して、select * from keyword where keyword = '胃';
とすると、正常に返ってきます。
その後の調査の結果、呼吸の「呼」の字があると
エラーになってしまうようです。
Postgresのサーバログには、

LOG:  database system was shut down at 2003-05-15 19:40:49 JST
LOG:  checkpoint record is at 0/4514580
LOG:  redo record is at 0/4514580; undo record is at 0/0; shutdown TRUE
LOG:  next transaction id: 49702; next oid: 57268
LOG:  database system is ready

のような記述が有ります。

これはUnicodeの問題なのでしょうか?
でも、psqlから実行するとうまくいきます。
とすると、JDBCドライバの問題なのかなとも
思います。

ご存知の方がいましたら、知恵を拝借したいと
思っております。よろしくお願いします。

ちなみに、JDBCはソースからコンパイルしています。










pgsql-jp メーリングリストの案内