[postgis-users] jdbc problem

Gilbert, Antoine AGilbert at korem.com
Mon Jan 16 09:57:19 PST 2006


My bad, the type is char(n), this explain the problem

Probably some options I didn't checked in the FME translator to charge
my data in postgresql

Thank you

-----Original Message-----
From: Markus Schaber [mailto:schabi at logix-tt.com] 
Sent: January 16, 2006 12:32 PM
To: PostGIS Users Discussion
Subject: Re: [postgis-users] jdbc problem

Hi, Gilbert,

Gilbert, Antoine wrote:

> I'am fetching records via the PostgreSQL JDBC driver.
> I have a strange problem. The string values always have some blank
> characters (or tab?) at the end.
> So if I have in the database 'British Columbia', it become in my java
> program with rs.getString() something like 'British Columbia    '.
> The select I'm using is basic : select Province_name from myTable
> When I try this query in the PostgreSQL admin console, I don't have
this
> problem.

What is the rows exact data type? Can you show us the output of
  \d tablename
in the psql console? This will show us the exact datatype

According to the PostgreSQL doc, there are three basic text types (with
some aliases):

character varying(n), varchar(n)     variable-length with limit	
character(n), char(n)                fixed-length, blank padded	
text	                             variable unlimited length

So if the column is defined as character(n) or char(n), the server will
automatically pad the text with blanks. Maybe the your admin console
strips trailing blanks, my psql seems not do do this.

> PS :  maybe I'am in the wrong forum to post this since it's not really
> PostGIS related.

Yes, the pgsql-jdbc at postgresql.org list will be better, I think.

HTH,
Markus

-- 
Markus Schaber | Logical Tracking&Tracing International AG
Dipl. Inf.     | Software Development GIS

Fight against software patents in EU! www.ffii.org
www.nosoftwarepatents.org
_______________________________________________
postgis-users mailing list
postgis-users at postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users




More information about the postgis-users mailing list