Getting information about MYSQL database structure from Java

I am trying to do with java and mysql the same thing I have used with .net and SQL server:

Using Microsoft.SqlServer.Management.Smo I can access information about the database structure from my instance (server name, table structure, columns, data type, description, default value)

I tried to find the same with Java + MYSQL, but it seems that it is not that popular

any directions?




source to share

3 answers

The easiest way to accomplish this is by repeating the connection metadata, first you open the connection:

Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/db", "user","****");
DatabaseMetaData metaData = conn.getMetaData();


then start navigating the metadata, you can check the available operations in DatabaseMedata



DatabaseMetaData will be helpful for your requirement.

please also check / ...



use DatabaseMetadata to get database related information. Database metadata



All Articles