permaculture playing cards*
The moose likes JDBC and the fly likes getPrimaryKeys() method of DatabaseMetaData Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "getPrimaryKeys() method of DatabaseMetaData" Watch "getPrimaryKeys() method of DatabaseMetaData" New topic
Author

getPrimaryKeys() method of DatabaseMetaData

sandeep kulkarni
Ranch Hand

Joined: Feb 25, 2004
Posts: 36
I'm facing very strange problem.
when I use the method getPrimaryKeys() for getting the list of primary keys of table.It is returing each value twice.(if there is only one key,it is returing the same key twice).
can anybody tell what might be the reason?
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30382
    
150

Sandeep,
I have no clue, but could you post the database and driver you are using? That might spark an idea for somebody.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30382
    
150

Also, does it do that for all tables or just one?
Julian Kennedy
Ranch Hand

Joined: Aug 02, 2004
Posts: 823
Sandeep,

Are you specifying anything for the schema and/or catalog parameters? It seems to me that if you have two schemas in your DB that contain the same table and PK, then a call to getPrimaryKeys() with an empty or null schema parameter would give you the same information twice.

Does that help shed any light on it?

Jules
sandeep kulkarni
Ranch Hand

Joined: Feb 25, 2004
Posts: 36
perfect Julian....
the problem is now solved.
thanks for ur comments
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: getPrimaryKeys() method of DatabaseMetaData