--- a/src/DriverManager.cpp Mon Jun 01 17:14:22 2020 +0200
+++ b/src/DriverManager.cpp Mon Jun 01 17:22:13 2020 +0200
@@ -66,10 +66,7 @@
(SQLCHAR*) dataSourceNameBytes.c_str(), SQL_NTS,
(SQLCHAR*) userNameBytes.c_str(), SQL_NTS,
(SQLCHAR*) passwordBytes.c_str(), SQL_NTS);
- if (OdbcCommon::isNotSuccessful(result)) {
- OdbcCommon::freeHandle(SQL_HANDLE_DBC, connection);
- throw SqlException(L"Unable to connect to DSN: " + dataSourceName, result, SQL_HANDLE_ENV, environment);
- }
+ if (OdbcCommon::isNotSuccessful(result)) throw SqlException(L"Unable to connect to DSN: " + dataSourceName, result, SQL_HANDLE_DBC, connection, true);
return new Connection(connection);
}