JoshWegener
asked on
Connection to MySQL using JDBC, get Constraints
Connection to MySQL using JDBC, get Constraints
How can I get the Constraints for each table? I am created a converter program that takes a mysql database and converts it into a FireBird database. The program connects to MySQL using JDBC, and creats the SQL query needed to create the same table in fireBird... I have got every thing but the Constraints.... How can I get them?
Thanks
Josh Wegener
How can I get the Constraints for each table? I am created a converter program that takes a mysql database and converts it into a FireBird database. The program connects to MySQL using JDBC, and creats the SQL query needed to create the same table in fireBird... I have got every thing but the Constraints.... How can I get them?
Thanks
Josh Wegener
Strictly in JDBC, only thing you can get might be ResultSetMetaData.isNullab le().
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Any examples? I have tryed to get at the Information_Schema before with no luck...
ASKER
BTW I am usting
MySQL 4.0.24-nt
MySQL 4.0.24-nt
Unforunately, information_schema table was introduced after mySql 5.0. Prior to it, you'd have to use Show only in mysql client.
hmm..
Do you still have script left or you can dump out all creat table statements. You can parse that script to find out all constraints.
Might be a way to go...
Acton
Do you still have script left or you can dump out all creat table statements. You can parse that script to find out all constraints.
Might be a way to go...
Acton
try
SHOW CREATE TABLE table_name;
SHOW CREATE TABLE table_name;
It shall give the primary key constraints
As I said, you can not do it inside JDBC only in mysql client, you might parse the script to get the informaiton.
try SHOW INNODB STATUS ;
It should show the constraints or the alter table scripts.
Let me know if it works
It should show the constraints or the alter table scripts.
Let me know if it works
or the SHOW TABLE STATUS;
ASKER
SHOW INNODB STATUS and the SHOW TABLE STATUS did not show me the constraints