Re: Re: PostgreSQL specific datatypes very confusing for beginners who use wrappers around JDBC

Поиск
Список
Период
Сортировка
От Kevin Grittner
Тема Re: Re: PostgreSQL specific datatypes very confusing for beginners who use wrappers around JDBC
Дата
Msg-id 1391038870.36107.YahooMailNeo@web122301.mail.ne1.yahoo.com
обсуждение исходный текст
Ответ на Re: Re: PostgreSQL specific datatypes very confusing for beginners who use wrappers around JDBC  (Florian Weimer <fweimer@redhat.com>)
Список pgsql-general
Florian Weimer <fweimer@redhat.com> wrote:

> Can you use other JDBC drivers (except SQLite) to insert
> Java Strings into NUMERIC columns and Java ints into text
> columns?

The JDBC specification can be downloaded from here:

http://download.oracle.com/otndocs/jcp/jdbc-4_1-mrel-spec/index.html

Check out appendix B.  According to the charts there, any of these
Java types (from table B-5):

  String
  java.math.BigDecimal
  Boolean
  Byte
  Short
  Integer
  Long
  Float
  Double

should be assignable using setObject and setNull to these JDBC
target types:

  TINYINT
  SMALLINT
  INTEGER
  BIGINT
  REAL
  FLOAT
  DOUBLE
  DECIMAL
  NUMERIC  BIT
  BOOLEAN
  CHAR
  VARCHAR
  LONGVARCHAR

In addition (from the same table) String should be assignable to:

  BINARY
  VARBINARY
  LONGVARBINARY
  DATE
  TIME
  TIMESTAMP

So, it's at least partly a question of whether we want to conform
to the JDBC specification.

--
Kevin Grittner
EDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


В списке pgsql-general по дате отправления:

Предыдущее
От: Jeff Janes
Дата:
Сообщение: Re: concurrent SELECT blocking ALTER?
Следующее
От: Craig Ringer
Дата:
Сообщение: Re: Re: PostgreSQL specific datatypes very confusing for beginners who use wrappers around JDBC