Skip site navigation (1) Skip section navigation (2)

Using java.lang.Character for "char" data type

From: Віталій Тимчишин <tivv00(at)gmail(dot)com>
To: PG-JDBC Mailing List <pgsql-jdbc(at)postgresql(dot)org>
Subject: Using java.lang.Character for "char" data type
Date: 2010-05-21 12:28:28
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-jdbc

I've tried to use Character to fill "char" column, e.g. like in the next
con.createStatement().execute("create table tst(tcol \"char\")");
PreparedStatement stmt = con.prepareStatement("insert into tst(tcol)
stmt.setObject(1, 'c');
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

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

Next:From: Kris JurkaDate: 2010-05-21 22:16:02
Subject: Re: Using java.lang.Character for "char" data type
Previous:From: LewDate: 2010-05-20 13:34:27
Subject: Re: Documentation improvements for PgJDBC

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group