Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 08-01-2007, 03:31 PM
Member
 
Join Date: Jul 2007
Posts: 26
osval is on a distinguished road
how to determine the primary key
can I determine the primary and the foreign key of my table in my Java Program. if it so How can I do that???
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 08-07-2007, 03:31 AM
Member
 
Join Date: Jul 2007
Posts: 36
boy22 is on a distinguished road
java.sql interface DatabaseMetaData

ResultSet getPrimaryKeys (String catalog,String schema,String table)throws SQLException

Retrieves a description of the given table's primary key columns. They are ordered by COLUMN_NAME.

Each primary key column description has the following columns:

TABLE_CAT String => table catalog (may be null)
TABLE_SCHEM String => table schema (may be null)
TABLE_NAME String => table name
COLUMN_NAME String => column name
KEY_SEQ short => sequence number within primary key
PK_NAME String => primary key name (may be null)

Parameters:
catalog - a catalog name; must match the catalog name as it is stored in the database; "" retrieves those without a catalog; null means that the catalog name should not be used to narrow the search
schema - a schema name; must match the schema name as it is stored in the database; "" retrieves those without a schema; null means that the schema name should not be used to narrow the search
table - a table name; must match the table name as it is stored in the database
Returns:
ResultSet - each row is a primary key column description
Throws:
SQLException - if a database access error occurs
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
JCombox DropDown is displayed on primary monitor when the box is in between two monit Kalpana.k AWT / Swing 1 05-01-2008 04:19 PM
How to determine all the IP addresses of machines on local LAN?? JavaEmpires Networking 3 01-19-2008 07:05 AM
How to determine CPU usage using Java????? JavaEmpires New To Java 2 01-11-2008 12:19 AM
How to determine if the value of a JTextField is double nemo New To Java 1 05-20-2007 12:19 PM


All times are GMT +3. The time now is 06:06 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org