--- a/java/sql-dk/src/info/globalcode/sql/dk/InfoLister.java Sun Sep 13 20:10:13 2015 +0200
+++ b/java/sql-dk/src/info/globalcode/sql/dk/InfoLister.java Wed Nov 09 00:18:01 2016 +0100
@@ -26,7 +26,6 @@
import info.globalcode.sql.dk.configuration.Properties;
import info.globalcode.sql.dk.configuration.Property;
import info.globalcode.sql.dk.configuration.PropertyDeclaration;
-import info.globalcode.sql.dk.configuration.PropertyDeclarations;
import info.globalcode.sql.dk.configuration.TunnelDefinition;
import info.globalcode.sql.dk.formatting.ColumnsHeader;
import info.globalcode.sql.dk.formatting.CommonProperties;
@@ -395,7 +394,9 @@
ColumnsHeader header = constructHeader(
new HeaderField("database_name", SQLType.VARCHAR),
new HeaderField("configured", SQLType.BOOLEAN),
- new HeaderField("connected", SQLType.BOOLEAN));
+ new HeaderField("connected", SQLType.BOOLEAN),
+ new HeaderField("product_name", SQLType.VARCHAR),
+ new HeaderField("product_version", SQLType.VARCHAR));
log.log(Level.FINE, "Testing DB connections in {0} threads", TESTING_THREAD_COUNT);
@@ -464,6 +465,8 @@
boolean succesfullyConnected = false;
boolean succesfullyConfigured = false;
+ String productName = null;
+ String productVersion = null;
try {
DatabaseDefinition dd = configurationProvider.getConfiguration().getDatabase(dbName);
@@ -471,13 +474,15 @@
succesfullyConfigured = true;
try (DatabaseConnection dc = dd.connect(options.getDatabaseProperties())) {
succesfullyConnected = dc.test();
+ productName = dc.getProductName();
+ productVersion = dc.getProductVersion();
}
log.log(Level.FINE, "Database connection test was successful");
} catch (ConfigurationException | SQLException | RuntimeException e) {
log.log(Level.SEVERE, "Error during testing connection " + dbName, e);
}
- return new Object[]{dbName, succesfullyConfigured, succesfullyConnected};
+ return new Object[]{dbName, succesfullyConfigured, succesfullyConnected, productName, productVersion};
}
private void printResource(String fileName) {
@@ -591,77 +596,77 @@
public enum InfoType {
HELP {
- @Override
- public void showInfo(InfoLister infoLister) {
- infoLister.printResource(Constants.HELP_FILE);
- }
- },
+ @Override
+ public void showInfo(InfoLister infoLister) {
+ infoLister.printResource(Constants.HELP_FILE);
+ }
+ },
VERSION {
- @Override
- public void showInfo(InfoLister infoLister) {
- infoLister.printResource(Constants.VERSION_FILE);
- }
- },
+ @Override
+ public void showInfo(InfoLister infoLister) {
+ infoLister.printResource(Constants.VERSION_FILE);
+ }
+ },
LICENSE {
- @Override
- public void showInfo(InfoLister infoLister) {
- infoLister.printResource(Constants.LICENSE_FILE);
- }
- },
+ @Override
+ public void showInfo(InfoLister infoLister) {
+ infoLister.printResource(Constants.LICENSE_FILE);
+ }
+ },
JAVA_PROPERTIES {
- @Override
- public void showInfo(InfoLister infoLister) throws FormatterException, ConfigurationException {
- infoLister.listJavaProperties();
- }
- },
+ @Override
+ public void showInfo(InfoLister infoLister) throws FormatterException, ConfigurationException {
+ infoLister.listJavaProperties();
+ }
+ },
ENVIRONMENT_VARIABLES {
- @Override
- public void showInfo(InfoLister infoLister) throws FormatterException, ConfigurationException {
- infoLister.listEnvironmentVariables();
- }
- },
+ @Override
+ public void showInfo(InfoLister infoLister) throws FormatterException, ConfigurationException {
+ infoLister.listEnvironmentVariables();
+ }
+ },
FORMATTERS {
- @Override
- public void showInfo(InfoLister infoLister) throws FormatterException, ConfigurationException {
- infoLister.listFormatters();
- }
- },
+ @Override
+ public void showInfo(InfoLister infoLister) throws FormatterException, ConfigurationException {
+ infoLister.listFormatters();
+ }
+ },
FORMATTER_PROPERTIES {
- @Override
- public void showInfo(InfoLister infoLister) throws FormatterException, ConfigurationException {
- infoLister.listFormatterProperties();
- }
- },
+ @Override
+ public void showInfo(InfoLister infoLister) throws FormatterException, ConfigurationException {
+ infoLister.listFormatterProperties();
+ }
+ },
TYPES {
- @Override
- public void showInfo(InfoLister infoLister) throws FormatterException, ConfigurationException {
- infoLister.listTypes();
- }
- },
+ @Override
+ public void showInfo(InfoLister infoLister) throws FormatterException, ConfigurationException {
+ infoLister.listTypes();
+ }
+ },
JDBC_DRIVERS {
- @Override
- public void showInfo(InfoLister infoLister) throws ConfigurationException, FormatterException {
- infoLister.listJdbcDrivers();
- }
- },
+ @Override
+ public void showInfo(InfoLister infoLister) throws ConfigurationException, FormatterException {
+ infoLister.listJdbcDrivers();
+ }
+ },
JDBC_PROPERTIES {
- @Override
- public void showInfo(InfoLister infoLister) throws ConfigurationException, FormatterException {
- infoLister.listJdbcProperties();
- }
- },
+ @Override
+ public void showInfo(InfoLister infoLister) throws ConfigurationException, FormatterException {
+ infoLister.listJdbcProperties();
+ }
+ },
DATABASES {
- @Override
- public void showInfo(InfoLister infoLister) throws FormatterException, ConfigurationException {
- infoLister.listDatabases();
- }
- },
+ @Override
+ public void showInfo(InfoLister infoLister) throws FormatterException, ConfigurationException {
+ infoLister.listDatabases();
+ }
+ },
CONNECTION {
- @Override
- public void showInfo(InfoLister infoLister) throws FormatterException, ConfigurationException {
- infoLister.testConnections();
- }
- };
+ @Override
+ public void showInfo(InfoLister infoLister) throws FormatterException, ConfigurationException {
+ infoLister.testConnections();
+ }
+ };
public abstract void showInfo(InfoLister infoLister) throws ConfigurationException, FormatterException;
}