Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Foreign keys of a particular Table

 
Manu Syal
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need to find the foreign key of a particular table. I am trying this code , but this does not give me all the foreign keys
DatabaseMetaData dbMetaData = con.getMetaData();
rs=dbMetaData.getImportedKeys(null,null,"PROJECT_MASTER");
Vector foreignkey=new Vector ();
Enumeration e5;
while(rs.next())
{
foreignkey.addElement(rs.getString(4));
}
e5=foreignkey.elements();

while(e5.hasMoreElements())
{
out.println((String)e5.nextElement());

}
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!