Re: Re: PostgreSQL specific datatypes very confusing for beginners who use wrappers around JDBC - Mailing list pgsql-general

From Kevin Grittner
Subject Re: Re: PostgreSQL specific datatypes very confusing for beginners who use wrappers around JDBC
Date
Msg-id 1391038870.36107.YahooMailNeo@web122301.mail.ne1.yahoo.com
Whole thread Raw
In response to Re: Re: PostgreSQL specific datatypes very confusing for beginners who use wrappers around JDBC  (Florian Weimer <fweimer@redhat.com>)
List 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 by date:

Previous
From: Jeff Janes
Date:
Subject: Re: concurrent SELECT blocking ALTER?
Next
From: Craig Ringer
Date:
Subject: Re: Re: PostgreSQL specific datatypes very confusing for beginners who use wrappers around JDBC