|
Yes, that is a good point. The AS qualifier will always work because the JDBC driver's do not figure out the underlying columns being used in a query, they ask the database for the column names of the result table. The AS clause names a column in the Result table so it will always work. There is nothing really preventing us from supporting qualified names either. Writing the code that would enable users to provide qualified names would not be too hard, but the performance overhead could be significant. Richard D. Dettinger AS/400 Java Data Access Team Democracy's enemies have always underestimated the courage of the American people. It was true at Concord Bridge. It was true at Pearl Harbor. And it was true today. Rochester Post-Bulletin Tuesday September 11, 2001 "David Morris" <David.Morris@plumcreek.com>@midrange.com on 11/20/2001 02:04:24 PM Please respond to java400-l@midrange.com Sent by: java400-l-admin@midrange.com To: <java400-l@midrange.com> cc: Subject: RE: java code help... Richard, One workaround is to use as. The following should work: select a.field as afield, b.field as bfield from a join b... Then specify afield and bfield. I have found the JDBC driver can vary widely in this area depending on who wrote it. For example, Oracle will let you use a qualified name with their OCI driver. Their thin driver will fail. Both work with ordinal references. All work with as or ordinal reference. David Morris > -----Original Message----- > From: Richard Dettinger [SMTP:cujo@us.ibm.com] > Sent: Friday, November 16, 2001 4:49 AM > To: java400-l@midrange.com > Subject: RE: java code help... > > > You can't qualify column names. Sorry its just not allowed. The > specification states that if a column name exists multiple times in a > ResultSet that the column name applies to the first entry. > > You could write your SQL statement to give the columns unique names. > That's the only work around available. > > BTW: Your app will perform better if you use the column indexes instead > of > the column names. Part of why using names instead of column indexes is so > expensive is because you have to do a linear search of the names of the > columns in the ResultSet for just this reason. If your ResultSet has 100 > rows and you are fetching the 100th row with a column name, you could be > spending an order of magnitude more time in the driver figuring out what > the column index is over actually doing the work of getting the data. > > Sorry, dude... I'm a JDBC driver writer... I have to say those types of > things to the application programmers. :-) > > Richard D. Dettinger > AS/400 Java Data Access Team > > Democracy's enemies have always underestimated the courage of the American > people. > It was true at Concord Bridge. It was true at Pearl Harbor. And it was > true today. > > Rochester Post-Bulletin > Tuesday September 11, 2001 _______________________________________________ This is the Java Programming on and around the iSeries / AS400 (JAVA400-L) mailing list To post a message email: JAVA400-L@midrange.com To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/cgi-bin/listinfo/java400-l or email: JAVA400-L-request@midrange.com Before posting, please take a moment to review the archives at http://archive.midrange.com/java400-l.
As an Amazon Associate we earn from qualifying purchases.
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.