--- a/src/DriverManager.cpp Sun May 31 21:20:24 2020 +0200
+++ b/src/DriverManager.cpp Mon Jun 01 00:14:40 2020 +0200
@@ -68,7 +68,7 @@
(SQLCHAR*) passwordBytes.c_str(), SQL_NTS);
if (OdbcCommon::isNotSuccessful(result)) {
OdbcCommon::freeHandle(SQL_HANDLE_DBC, connection);
- throw SqlException(L"Unable to connect to " + dataSourceName, result, SQL_HANDLE_ENV, environment);
+ throw SqlException(L"Unable to connect to DSN: " + dataSourceName, result, SQL_HANDLE_ENV, environment);
}
return new Connection(connection);
}
@@ -82,7 +82,10 @@
(SQLCHAR*) convertor.to_bytes(connectionString).c_str(), SQL_NTS,
(SQLCHAR*) completeConnectionString, sizeof (completeConnectionString), &completeConnectionStringLength,
SQL_DRIVER_NOPROMPT);
- if (OdbcCommon::isNotSuccessful(result)) throw SqlException(L"Unable to connect to " + connectionString, result, SQL_HANDLE_ENV, environment);
+ if (OdbcCommon::isNotSuccessful(result)) {
+ OdbcCommon::freeHandle(SQL_HANDLE_DBC, connection);
+ throw SqlException(L"Unable to connect to URL: " + connectionString, result, SQL_HANDLE_ENV, environment);
+ }
return new Connection(connection);
}