diff --git a/services/src/main/java/org/fao/geonet/api/site/SiteInformation.java b/services/src/main/java/org/fao/geonet/api/site/SiteInformation.java index 89a930aec05..7041658c6dc 100644 --- a/services/src/main/java/org/fao/geonet/api/site/SiteInformation.java +++ b/services/src/main/java/org/fao/geonet/api/site/SiteInformation.java @@ -227,6 +227,21 @@ private void loadDatabaseInfo(ServiceContext context) throws SQLException { connection = context.getBean(DataSource.class).getConnection(); dbURL = connection.getMetaData().getURL(); databaseProperties.put("db.openattempt", "Database Opened Successfully"); + try { + databaseProperties.put("db.type", connection.getMetaData().getDatabaseProductName()); + databaseProperties.put("db.version", connection.getMetaData().getDatabaseProductVersion()); + databaseProperties.put("db.driver", connection.getMetaData().getDriverName()); + databaseProperties.put("db.driverVersion", connection.getMetaData().getDriverVersion()); + databaseProperties.put("db.username", connection.getMetaData().getUserName()); + databaseProperties.put("db.name", connection.getCatalog()); + // Put "db.schema" field last as getSchema() has a known issues with the jetty jndi h2 drivers which is most likely related to a driver mismatch issue. + // Receiver class org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper does not define or inherit an implementation of the resolved method 'abstract java.lang.String getSchema()' of interface java.sql.Connection. + databaseProperties.put("db.schema", connection.getSchema()); + } catch (AbstractMethodError e) { + // Most likely driver mismatch + // https://stackoverflow.com/questions/17969365/why-i-am-getting-java-lang-abstractmethoderror-errors + Log.warning(Geonet.GEONETWORK, "Failed to get db properties. " + e.getMessage()); + } if (connection instanceof BasicDataSource) { BasicDataSource basicDataSource = (BasicDataSource) connection; diff --git a/web-ui/src/main/resources/catalog/locales/en-admin.json b/web-ui/src/main/resources/catalog/locales/en-admin.json index 1ae5dc67565..16a7da1f586 100644 --- a/web-ui/src/main/resources/catalog/locales/en-admin.json +++ b/web-ui/src/main/resources/catalog/locales/en-admin.json @@ -196,6 +196,13 @@ "db.numidle": "Available connections", "db.openattempt": "Status", "db.url": "JDBC URL", + "db.type": "Type", + "db.version": "Version", + "db.driver": "JDBC Driver", + "db.driverVersion": "JDBC Driver Version", + "db.username": "Username", + "db.schema": "Schema", + "db.name": "Name", "dbInformation": "Database", "dbUrl": "Database", "defineCatalogLogo": "Define the logo to use for the catalog",