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

From: Kevin Grittner <kgrittn(at)ymail(dot)com>
To: Florian Weimer <fweimer(at)redhat(dot)com>, Craig Ringer <craig(at)2ndquadrant(dot)com>, David Johnston <polobo(at)yahoo(dot)com>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>, Merlin Göttlinger <megoettlinger(at)gmail(dot)com>
Subject: Re: Re: PostgreSQL specific datatypes very confusing for beginners who use wrappers around JDBC
Date: 2014-01-29 23:41:10
Message-ID: 1391038870.36107.YahooMailNeo@web122301.mail.ne1.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Florian Weimer <fweimer(at)redhat(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Craig Ringer 2014-01-30 02:46:32 Re: Re: PostgreSQL specific datatypes very confusing for beginners who use wrappers around JDBC
Previous Message Jeff Janes 2014-01-29 23:33:16 Re: concurrent SELECT blocking ALTER?