1.1 --- a/java/sql-dk/src/info/globalcode/sql/dk/InfoLister.java Sun Sep 13 20:10:13 2015 +0200
1.2 +++ b/java/sql-dk/src/info/globalcode/sql/dk/InfoLister.java Wed Nov 09 00:18:01 2016 +0100
1.3 @@ -26,7 +26,6 @@
1.4 import info.globalcode.sql.dk.configuration.Properties;
1.5 import info.globalcode.sql.dk.configuration.Property;
1.6 import info.globalcode.sql.dk.configuration.PropertyDeclaration;
1.7 -import info.globalcode.sql.dk.configuration.PropertyDeclarations;
1.8 import info.globalcode.sql.dk.configuration.TunnelDefinition;
1.9 import info.globalcode.sql.dk.formatting.ColumnsHeader;
1.10 import info.globalcode.sql.dk.formatting.CommonProperties;
1.11 @@ -395,7 +394,9 @@
1.12 ColumnsHeader header = constructHeader(
1.13 new HeaderField("database_name", SQLType.VARCHAR),
1.14 new HeaderField("configured", SQLType.BOOLEAN),
1.15 - new HeaderField("connected", SQLType.BOOLEAN));
1.16 + new HeaderField("connected", SQLType.BOOLEAN),
1.17 + new HeaderField("product_name", SQLType.VARCHAR),
1.18 + new HeaderField("product_version", SQLType.VARCHAR));
1.19
1.20 log.log(Level.FINE, "Testing DB connections in {0} threads", TESTING_THREAD_COUNT);
1.21
1.22 @@ -464,6 +465,8 @@
1.23
1.24 boolean succesfullyConnected = false;
1.25 boolean succesfullyConfigured = false;
1.26 + String productName = null;
1.27 + String productVersion = null;
1.28
1.29 try {
1.30 DatabaseDefinition dd = configurationProvider.getConfiguration().getDatabase(dbName);
1.31 @@ -471,13 +474,15 @@
1.32 succesfullyConfigured = true;
1.33 try (DatabaseConnection dc = dd.connect(options.getDatabaseProperties())) {
1.34 succesfullyConnected = dc.test();
1.35 + productName = dc.getProductName();
1.36 + productVersion = dc.getProductVersion();
1.37 }
1.38 log.log(Level.FINE, "Database connection test was successful");
1.39 } catch (ConfigurationException | SQLException | RuntimeException e) {
1.40 log.log(Level.SEVERE, "Error during testing connection " + dbName, e);
1.41 }
1.42
1.43 - return new Object[]{dbName, succesfullyConfigured, succesfullyConnected};
1.44 + return new Object[]{dbName, succesfullyConfigured, succesfullyConnected, productName, productVersion};
1.45 }
1.46
1.47 private void printResource(String fileName) {
1.48 @@ -591,77 +596,77 @@
1.49 public enum InfoType {
1.50
1.51 HELP {
1.52 - @Override
1.53 - public void showInfo(InfoLister infoLister) {
1.54 - infoLister.printResource(Constants.HELP_FILE);
1.55 - }
1.56 - },
1.57 + @Override
1.58 + public void showInfo(InfoLister infoLister) {
1.59 + infoLister.printResource(Constants.HELP_FILE);
1.60 + }
1.61 + },
1.62 VERSION {
1.63 - @Override
1.64 - public void showInfo(InfoLister infoLister) {
1.65 - infoLister.printResource(Constants.VERSION_FILE);
1.66 - }
1.67 - },
1.68 + @Override
1.69 + public void showInfo(InfoLister infoLister) {
1.70 + infoLister.printResource(Constants.VERSION_FILE);
1.71 + }
1.72 + },
1.73 LICENSE {
1.74 - @Override
1.75 - public void showInfo(InfoLister infoLister) {
1.76 - infoLister.printResource(Constants.LICENSE_FILE);
1.77 - }
1.78 - },
1.79 + @Override
1.80 + public void showInfo(InfoLister infoLister) {
1.81 + infoLister.printResource(Constants.LICENSE_FILE);
1.82 + }
1.83 + },
1.84 JAVA_PROPERTIES {
1.85 - @Override
1.86 - public void showInfo(InfoLister infoLister) throws FormatterException, ConfigurationException {
1.87 - infoLister.listJavaProperties();
1.88 - }
1.89 - },
1.90 + @Override
1.91 + public void showInfo(InfoLister infoLister) throws FormatterException, ConfigurationException {
1.92 + infoLister.listJavaProperties();
1.93 + }
1.94 + },
1.95 ENVIRONMENT_VARIABLES {
1.96 - @Override
1.97 - public void showInfo(InfoLister infoLister) throws FormatterException, ConfigurationException {
1.98 - infoLister.listEnvironmentVariables();
1.99 - }
1.100 - },
1.101 + @Override
1.102 + public void showInfo(InfoLister infoLister) throws FormatterException, ConfigurationException {
1.103 + infoLister.listEnvironmentVariables();
1.104 + }
1.105 + },
1.106 FORMATTERS {
1.107 - @Override
1.108 - public void showInfo(InfoLister infoLister) throws FormatterException, ConfigurationException {
1.109 - infoLister.listFormatters();
1.110 - }
1.111 - },
1.112 + @Override
1.113 + public void showInfo(InfoLister infoLister) throws FormatterException, ConfigurationException {
1.114 + infoLister.listFormatters();
1.115 + }
1.116 + },
1.117 FORMATTER_PROPERTIES {
1.118 - @Override
1.119 - public void showInfo(InfoLister infoLister) throws FormatterException, ConfigurationException {
1.120 - infoLister.listFormatterProperties();
1.121 - }
1.122 - },
1.123 + @Override
1.124 + public void showInfo(InfoLister infoLister) throws FormatterException, ConfigurationException {
1.125 + infoLister.listFormatterProperties();
1.126 + }
1.127 + },
1.128 TYPES {
1.129 - @Override
1.130 - public void showInfo(InfoLister infoLister) throws FormatterException, ConfigurationException {
1.131 - infoLister.listTypes();
1.132 - }
1.133 - },
1.134 + @Override
1.135 + public void showInfo(InfoLister infoLister) throws FormatterException, ConfigurationException {
1.136 + infoLister.listTypes();
1.137 + }
1.138 + },
1.139 JDBC_DRIVERS {
1.140 - @Override
1.141 - public void showInfo(InfoLister infoLister) throws ConfigurationException, FormatterException {
1.142 - infoLister.listJdbcDrivers();
1.143 - }
1.144 - },
1.145 + @Override
1.146 + public void showInfo(InfoLister infoLister) throws ConfigurationException, FormatterException {
1.147 + infoLister.listJdbcDrivers();
1.148 + }
1.149 + },
1.150 JDBC_PROPERTIES {
1.151 - @Override
1.152 - public void showInfo(InfoLister infoLister) throws ConfigurationException, FormatterException {
1.153 - infoLister.listJdbcProperties();
1.154 - }
1.155 - },
1.156 + @Override
1.157 + public void showInfo(InfoLister infoLister) throws ConfigurationException, FormatterException {
1.158 + infoLister.listJdbcProperties();
1.159 + }
1.160 + },
1.161 DATABASES {
1.162 - @Override
1.163 - public void showInfo(InfoLister infoLister) throws FormatterException, ConfigurationException {
1.164 - infoLister.listDatabases();
1.165 - }
1.166 - },
1.167 + @Override
1.168 + public void showInfo(InfoLister infoLister) throws FormatterException, ConfigurationException {
1.169 + infoLister.listDatabases();
1.170 + }
1.171 + },
1.172 CONNECTION {
1.173 - @Override
1.174 - public void showInfo(InfoLister infoLister) throws FormatterException, ConfigurationException {
1.175 - infoLister.testConnections();
1.176 - }
1.177 - };
1.178 + @Override
1.179 + public void showInfo(InfoLister infoLister) throws FormatterException, ConfigurationException {
1.180 + infoLister.testConnections();
1.181 + }
1.182 + };
1.183
1.184 public abstract void showInfo(InfoLister infoLister) throws ConfigurationException, FormatterException;
1.185 }