MIDRANGE dot COM Mailing List Archive



Home » JAVA400-L » September 2006

Re: How do I retrieve the every field length defined in DDL with JDBC ?



fixed

Joe & Keith,
   Thanks your help.

Vengoal

-------- Original Message  --------
From: "Joe Sam Shirah" <joe_sam@xxxxxxxxxxxxx>
To: "Java Programming on and around the iSeries / AS400" <java400-l@xxxxxxxxxxxx> Subject: Re:How do I retrieve the every field length defined in DDL with JDBC ?
Date: 2006/9/7 AM 12:11

   Hi Vengoal,

   Depending on your needs, Keith's answer of
ResultSetMetaData.getColumnDisplaySize() is probably enough.  If you need
more information and specifics about the columns, you can also use
DatabaseMetaData.getColumns().

   There's actually an example of both methods in the list archives at:

http://archive.midrange.com/java101/200107/msg00035.html

   I also have an example using ResultSetMetaData.getColumnDisplaySize() to
set up a fixed font display in one of the exercises for my JDBC tutorial at
Sun's developer site.  The complete program is at:

http://java.sun.com/developer/onlineTraining/Database/JDBC20Intro/exercises/SRS/solution/ScrollResultJ.java


                                                        Joe Sam

Joe Sam Shirah -        http://www.conceptgo.com
conceptGO       -        Consulting/Development/Outsourcing
Java Filter Forum:       http://www.ibm.com/developerworks/java/
Just the JDBC FAQs: http://www.jguru.com/faq/JDBC
Going International?    http://www.jguru.com/faq/I18N
Que Java400?            http://www.jguru.com/faq/Java400


----- Original Message ----- From: "McCully, Keith (RBS Insurance)" <Keith.McCully@xxxxxxxxx>
To: "'Java Programming on and around the iSeries / AS400'"
<java400-l@xxxxxxxxxxxx>
Sent: Wednesday, September 06, 2006 5:21 AM
Subject: RE: How do I retrieve the every field length defined in DDL with
JDBC ?


Hi Vengoal,

Create a ResultSetMetaData object then use its getColumnDisplaySize method
for every column.

If you want further info then refer to the JDBC API docs.

Regards,

Keith

-----Original Message-----
From: java400-l-bounces@xxxxxxxxxxxx
[mailto:java400-l-bounces@xxxxxxxxxxxx]
Sent: 06 September 2006 04:56
To: Java Programming on and around the iSeries / AS400
Subject: How do I retrieve the every field length defined in DDL with JDBC
?
*** WARNING : This message originates from the Internet ***

Hi,
   I have one table created with following DDL:

CREATE TABLE ACTION
(
 ACTIONCD      CHAR(1),
 ACTDEP            CHAR(10),
 DESCRIPTION  VARCHAR(80),
 SHORTDESC    VARCHAR(10)
)

How do I retrieve the atble's  every field length defined in DDL with JDBC
?
Best regards,

Vengoal
--






Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2014 by MIDRANGE dot COM and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available here. If you have questions about this, please contact