Getting exact string length from char fields in JDBC

From: "Sulakshana Awsarikar" <sulakshana(at)mithi(dot)com>
To: <pgsql-jdbc(at)postgresql(dot)org>
Subject: Getting exact string length from char fields in JDBC
Date: 2002-01-23 13:02:58
Message-ID: 008a01c1a40e$48244b00$0500a8c0@vsnl.net.in
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Hi

I have recently shifted from using MySQL to PostgreSQL. I have a field in my
table which is of type char(10) .

When I do a getString() for this field using JDBC, I get a string of 10
characters even if the actual data is say 5 characters in length. The
remaining 5 characters are spaces.

This was not happening while using MySQL.

How can I get the actual data without spaces when I do a getString() without
having to add any kind of trimming code in the Java code.

regards
Sulaksana

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Ola Sundell 2002-01-23 13:28:46 Re: Getting exact string length from char fields in JDBC
Previous Message Sean Duffy 2002-01-22 21:02:20 Re: Handling null values in char fields from JDBC