Author: vyemialyanchyk
Date: 2009-04-08 07:18:05 -0400 (Wed, 08 Apr 2009)
New Revision: 14600
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConsoleConfiguration.java
Log:
JBIDE-4138 - cosmetic change in currently unused function autoConfigureDialect
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConsoleConfiguration.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConsoleConfiguration.java 2009-04-08
11:13:50 UTC (rev 14599)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConsoleConfiguration.java 2009-04-08
11:18:05 UTC (rev 14600)
@@ -30,6 +30,7 @@
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
+import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.Driver;
import java.sql.DriverManager;
@@ -318,16 +319,25 @@
String url = localCfg.getProperty(Environment.URL);
String user = localCfg.getProperty(Environment.USER);
String pass = localCfg.getProperty(Environment.PASS);
+ Connection connection = null;
try {
- DatabaseMetaData meta = DriverManager.getConnection(url, user,
pass).getMetaData();
+ connection = DriverManager.getConnection(url, user, pass);
+ DatabaseMetaData meta = connection.getMetaData();
String databaseName = meta.getDatabaseProductName();
int databaseMajorVersion = meta.getDatabaseMajorVersion();
//SQL Dialect:
Dialect dialect = DialectFactory.buildDialect( localCfg.getProperties(),
databaseName, databaseMajorVersion );
localCfg.setProperty(Environment.DIALECT, dialect.toString());
- } catch (Exception e) {
+ } catch (SQLException e) {
//can't determine dialect
}
+ if (connection != null) {
+ try {
+ connection.close();
+ } catch (SQLException e) {
+ // ignore
+ }
+ }
}
}