Using char fields with 7.1.3 driver

From: <jeffdavey(at)submersion(dot)com>
To: <pgsql-jdbc(at)postgresql(dot)org>
Subject: Using char fields with 7.1.3 driver
Date: 2001-09-07 01:22:27
Message-ID: 40270.208.38.32.236.999825747.squirrel@webmail.submersion.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

I've found after using a CMP J2EE entity bean, along with the 7.1.3 jdbc
driver, queries return the entire char field back while using char(), but
varchar returns just the value of the field back.

for example,

create table test_table(
id integer primary key not null,
name varchar(255)
);

vs.

create table test_table(
id integer primary key not null,
name char(255)
);

When returning the name value from the first table it looks something like
this (single quotes are in just to show the entire field)

'Name'

However, when using the second table this happens:

'Name

'

notice the 249 characters of whitespace.

I can easily get around this using .trim(), but I'm wondering if that
should be in the jdbc driver itself (as I'll have to go through a bit of
code looking for string values being returned).

Or is this something in the database software itself that you can configure?

Also, Is there a "real" Website for the postgres jdbc driver?
http://jdbc.postgresql.org seems a little outdated.

I wouldn't mind being able to grab the source for the driver and putting in
this small fix myself.

-Jeff

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message David Wall 2001-09-07 01:28:50 Re: Using char fields with 7.1.3 driver
Previous Message Dave Cramer 2001-09-07 01:10:16 Re: error - NOTICE: current transaction...MORE DETAIL...