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

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search archives
  Advanced Search

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: Wed, 23 Jan 2002 18:32:58 +0530
  • Message-id: <008a01c1a40e$48244b00$0500a8c0@vsnl.net.in> <text/plain>

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




Home | Main Index | Thread Index

Privacy Policy | About PostgreSQL
Copyright © 1996 – 2012 PostgreSQL Global Development Group