Using java.lang.Character for "char" data type - Mailing list pgsql-jdbc

From Віталій Тимчишин
Subject Using java.lang.Character for "char" data type
Date
Msg-id AANLkTinKef9bhdEhYMMzxiRLKUXtGt_cUOnIPT5sibXI@mail.gmail.com
Whole thread Raw
Responses Re: Using java.lang.Character for "char" data type
List pgsql-jdbc
Hello.

I've tried to use Character to fill "char" column, e.g. like in the next test:
-----
con.createStatement().execute("create table tst(tcol \"char\")");
PreparedStatement stmt = con.prepareStatement("insert into tst(tcol) values(?)");
stmt.setObject(1, 'c');
stmt.executeUpdate();
-----
and got 
Exception in thread "main" org.postgresql.util.PSQLException: Can't infer the SQL type to use for an instance of java.lang.Character. Use setObject() with an explicit Types value to specify the type to use. at org.postgresql.jdbc2.AbstractJdbc2Statement.setObject(AbstractJdbc2Statement.java:1740)

with 8.3-603.jdbc4 driver.
May be it would be reasonable to treat Character like String of size 1?

--
Best regards,
Vitalii Tymchyshyn

pgsql-jdbc by date:

Previous
From: Craig Ringer
Date:
Subject: Documentation improvements for PgJDBC
Next
From: Kris Jurka
Date:
Subject: Re: Using java.lang.Character for "char" data type