Re: How to write java code to get the version info of Mysql connector/J
Posted by: Filipe Silva
Date: February 16, 2016 05:14AM

Version information can be obtained via java.sql.Driver:

Driver drv = DriverManager.getDriver("jdbc:mysql://localhost:3306");
System.out.println(drv.getMajorVersion() + "." + drv.getMinorVersion());

This only gets you major and minor version though.
For complete information consult java.sql.DatabaseMetaData:

DatabaseMetaData dbmd = DriverManager.getConnection(...);
System.out.println(dbmd.getDriverName() + " - " + dbmd.getDriverVersion() + " (" + dbmd.getDriverMajorVersion() + "." + dbmd.getDriverMinorVersion() + ")");


I hope that helps.

Options: ReplyQuote


Subject
Written By
Posted
Re: How to write java code to get the version info of Mysql connector/J
February 16, 2016 05:14AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.