× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.




Hi David,

I think you're going to have problems with anything reasonable to bypass
DDS Alias column names. As you probably know, here's what the manual says:

"ALIAS (Alternative Name) keyword for physical and logical files

"Use this field-level keyword to specify an alternative name for a field.
When the program is compiled, the alternative name is brought into the
program instead of the DDS field name."

The javadoc for AS400JDBCResultSet says:

"Columns can have two names: a column name ("long name") and a system column
name ("short name"). The get methods and findColumn() only support using the
column name."

As you've found, the last isn't completely true, but it does appear to
be true that you must *specify* the system column name to use it.
ResultSetMetaData has nothing for it, nor are there any driver properties I
could find.

There's almost always a way, but.... If you absolutely have to, you can
query QSYS/QADBIFLD, which has both long and short names. If you are using
a collection, you could query those tables rather than going to qsys. It's
possible that DataBaseMetaData may return it in some of the table info as
well - I didn't go that deep. And I'm not the end-all authority, but that's
the way it looks to me. HTH, if only to save some research time.


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: "David Gibbs" <david@xxxxxxxxxxxx>
To: "Java Programming on and around the iSeries / AS400"
<java400-l@xxxxxxxxxxxx>
Sent: Thursday, April 12, 2007 9:40 AM
Subject: JDBC & DDS Aliases


Folks:

I'm having a problem with JDBC that has me kind of puzzled.

I'm trying to run a very simple query against a file ... if I run the
query specifying the DDS defined field names, and do my
rs.getXXX("fieldname") it works fine.

However, since I am specifying a lot of fields to be retrieved, I
decided to change to do a simple 'select * from file' ... when I do
this, trying to access the values using the DDS field name doesn't work.
I get a SQLException indicating that the field is unknown.

If I try to retrieve the values using the DDS Alias field name it works
fine.

Is there any setting I can put on my connection (or the select
statement) that will let me retrieve the values using the DDS field name
instead of the DDS Alias name?

Thanks!

david
--



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.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 on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.