Alex Feng Lau

Greenhorn
+ Follow
since Nov 20, 2010
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Alex Feng Lau

I believe you are right, this is probably a driver issue. I will try to use Oracle and see how that goes. Thank you for all your help Scott!
I tried downloading and importing the latest driver, but I do not know if it supports getExportedKeys().

mysql-connector-java-6.0-nightly-20101119-bin.jar

An example here shows hints that it should work for MySQL databases though.
http://www.java2s.com/Code/Java/Database-SQL-JDBC/GetForeignKeys.htm

I also tried this query, but it didn't return any results. I'm assuming pdb is the database name and ptable is the table name. I found this from http://www.artfulsoftware.com/infotree/mysqlquerytree.php

I'm trying to dynamically get the parent table names and foreign key column names of a database. However, when I try to use getExportedKeys() it returns an empty ResultSet.

I have read on another thread that this may be a known bug. The thread recommends upgrading the mysql connector to the latest version. I have upgraded to the latest alpha mysql-connector-java-6.0-nightly-20101119-bin.jar for Mac OS X but the issue still remains.

http://www.tonews.com/thread/1395546/mailing/database/mysqljava/databasemetadata_getexportedkeys.html

I have created a simple table using a .sql script. I am using MySQL.


I am using the following to extract the results from the database.


I am able to retrieve primary keys calling getPrimaryKeys() just fine. However, calling getExportedKeys() always returns a ResultSet that is empty. What might I be doing incorrectly? Thank you for reading this!