[postgis-users] jdbc problem
Markus Schaber
schabi at logix-tt.com
Mon Jan 16 09:32:17 PST 2006
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
More information about the postgis-users
mailing list