Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / Databases / January 2005

Tip: Looking for answers? Try searching our database.

DB2 Identity column discovery

Thread view: 
Wayne Collins - 24 Jan 2005 01:05 GMT
I have a problem with JDBC and DB2 and am wondering if any one can help
with it. The problem is the following - after connecting to a DB2
database we use the getMetaData() method to retrieve a lot of data about
a table, but we have not discovered a way to determine if a particular
column of the data has an attribute like "GENERATED ALWAYS AS IDENTITY".

Anyone have a solution?
Lee Fesperman - 24 Jan 2005 08:06 GMT
> I have a problem with JDBC and DB2 and am wondering if any one can help
> with it. The problem is the following - after connecting to a DB2
[quoted text clipped - 3 lines]
>
> Anyone have a solution?

You didn't say, but I assume you're talking about the DatabaseMetaData object. It
doesn't provide that information. ResultSetMetaData, OTOH, does. Look at
isAutoIncrement() in java.sql.ResultSetMetaData.

Signature

Lee Fesperman, FFE Software, Inc. (http://www.firstsql.com)
==============================================================
* The Ultimate DBMS is here!
* FirstSQL/J Object/Relational DBMS  (http://www.firstsql.com)

Wayne Collins - 26 Jan 2005 02:25 GMT
>>I have a problem with JDBC and DB2 and am wondering if any one can help
>>with it. The problem is the following - after connecting to a DB2
[quoted text clipped - 7 lines]
> doesn't provide that information. ResultSetMetaData, OTOH, does. Look at
> isAutoIncrement() in java.sql.ResultSetMetaData.

Actually I was aware of isAutoIncrement from the ResultSetMetaData
object. But it always returns 'false' even on a column I know to be
GENERATED AS IDENTITY. Don't know what's wrong ... I'll keep tweaking it
to see if I can get it to work....
Lee Fesperman - 26 Jan 2005 08:05 GMT
> >>I have a problem with JDBC and DB2 and am wondering if any one can help
> >>with it. The problem is the following - after connecting to a DB2
[quoted text clipped - 12 lines]
> GENERATED AS IDENTITY. Don't know what's wrong ... I'll keep tweaking it
> to see if I can get it to work....

Too bad. java.sql.ResultSetMetaData is an interface, and correct implementation is
entirely up to the JDBC driver.

Signature

Lee Fesperman, FFE Software, Inc. (http://www.firstsql.com)
==============================================================
* The Ultimate DBMS is here!
* FirstSQL/J Object/Relational DBMS  (http://www.firstsql.com)

Bob Kranson - 24 Jan 2005 20:07 GMT
What platform of DB2 and version?  I recall some strange works in AS400
using the ALIAS property for table names....

>I have a problem with JDBC and DB2 and am wondering if any one can help
>with it. The problem is the following - after connecting to a DB2 database
[quoted text clipped - 3 lines]
>
> Anyone have a solution?


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.