From db34b35d959574db51b5b1576cb3296ff8cf7542 Mon Sep 17 00:00:00 2001 From: gmantele <gmantele@ari.uni-heidelberg.de> Date: Fri, 10 Mar 2017 12:11:19 +0100 Subject: [PATCH] [TAP] Use a more standard way to get the DBMS name. Two comments: - JDBCConnection.getDBMSName(String url) is now deprecated ; it may disappear in a next version of the ADQLLibrary. - In case the DBMS name can not be retrieved (generally because of an incomplete JDBC driver implementation), NULL will be returned. --- src/tap/db/JDBCConnection.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/tap/db/JDBCConnection.java b/src/tap/db/JDBCConnection.java index 1281218..a10a41e 100644 --- a/src/tap/db/JDBCConnection.java +++ b/src/tap/db/JDBCConnection.java @@ -361,7 +361,7 @@ public class JDBCConnection implements DBConnection { // Set the supporting features' flags + DBMS type: try{ DatabaseMetaData dbMeta = connection.getMetaData(); - dbms = getDBMSName(dbMeta.getURL()); + dbms = (dbMeta.getDatabaseProductName() != null ? dbMeta.getDatabaseProductName().toLowerCase() : null); supportsTransaction = dbMeta.supportsTransactions(); supportsBatchUpdates = dbMeta.supportsBatchUpdates(); supportsDataDefinition = dbMeta.supportsDataDefinitionAndDataManipulationTransactions(); @@ -386,7 +386,10 @@ public class JDBCConnection implements DBConnection { * @return The DBMS name as found in the given URL. * * @throws DBException If NULL has been given, if the URL is not a JDBC one (starting with "jdbc:") or if the DBMS name is missing. + * + * @deprecated (since 2.1) Should be replaced by <code>{@link java.sql.DatabaseMetaData#getDatabaseProductName()}.toLowerCase()</code>. */ + @Deprecated protected static final String getDBMSName(String dbUrl) throws DBException{ if (dbUrl == null) throw new DBException("Missing database URL!"); -- GitLab