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

TEXT columns should indentify as java.sql.Types.CLOB

From: Toni Helenius <Toni(dot)Helenius(at)syncrontech(dot)com>
To: "pgsql-jdbc(at)postgresql(dot)org" <pgsql-jdbc(at)postgresql(dot)org>
Subject: TEXT columns should indentify as java.sql.Types.CLOB
Date: 2010-08-16 09:01:56
Message-ID: E6A9CAA76548CB4EB02D2E3B174DD3B155381F0DF3@ink.sad.syncrontech.com (view raw or flat)
Thread:
Lists: pgsql-jdbc
Hello,

I'm using Postgres 8.3.11 database and the latest JDBC driver 8.4 Build 701 (JDBC 4) + Java 6. In our databases there are TEXT type columns. However if I make a query to identify these fields in Java, the field DATA TYPE is VARCHAR and the length is 2147483647. Type name is correct; "TEXT". But as we need database independent code, we are using DATA TYPE as I presume is correct. And I think these TEXT fields should return java.sql.Types.CLOB as DATA TYPE instead of VARCHAR.

Here is some code:

Connection fromConn;
DatabaseMetaData metaFrom;
String userFrom;

fromConn = from.getConnection();
metaFrom = fromConn.getMetaData();
userFrom = ((PooledConnection)from).getTableOwner();

ResultSet cols = metaFrom.getColumns(null, userFrom, code, null);
while (cols.next()) {
	cols.getShort("DATA_TYPE");
	cols.getString("TYPE_NAME");
	}

--
Toni Helenius / Syncron Tech Oy
Lappeenranta, Finland


Responses

pgsql-jdbc by date

Next:From: Thomas KellererDate: 2010-08-16 09:30:07
Subject: Re: TEXT columns should indentify as java.sql.Types.CLOB
Previous:From: Adam TodorskiDate: 2010-08-11 12:59:13
Subject: Returning generated keys

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