Getting a MySQL table's key and engine information from a statement's metadata using java

62 Views Asked by At

I am in the process of writing a java class that will read tables from a database that exists on one database server and will then recreate the tables in another database that resides on a different server.

With the above in mind, I am obtaining the most of the tables' metadata from a result set that reads from the source database. I say most because I am unsure where I can information on the keys, the auto-increment, engine information.
Can I get this information via the statement's metadata? Or should I be looking elsewhere for this information? Possibly the database's metadata???

If this helps, here is a snippet of the code - as you can see, quite basic stuff.

 Statement sourceStmt = sourceConnection.createStatement();
 ResultSet sourceRS = sourceStmt.executeQuery("select * from " + tableName);

--> this is how I am getting the metadata and am not sure if this is correct or not in regards to wanting to get the key and engine type information.

sourceDataRS.getMetaData();

Any information you can offer is greatly appreciated.

0

There are 0 best solutions below