changed SimpleConnectionManager to properly raise an exception when

the ODBC data source can not be found
This commit is contained in:
maroy 2005-03-26 18:43:40 +00:00
parent 6398a28317
commit d2f1979923

View file

@ -22,7 +22,7 @@
Author : $Author: maroy $ Author : $Author: maroy $
Version : $Revision: 1.1 $ Version : $Revision: 1.2 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/db/src/SimpleConnectionManager.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/db/src/SimpleConnectionManager.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -119,9 +119,14 @@ Ptr<odbc::Connection>::Ref
SimpleConnectionManager :: getConnection(void) SimpleConnectionManager :: getConnection(void)
throw (std::runtime_error) throw (std::runtime_error)
{ {
odbc::Connection * conn = odbc::DriverManager::getConnection(dsn, odbc::Connection * conn;
userName,
password); try {
conn = odbc::DriverManager::getConnection(dsn, userName, password);
} catch (std::exception &e) {
throw std::runtime_error(e.what());
}
if (!conn) { if (!conn) {
std::string eMsg = "unable to option ODBC connection for DSN "; std::string eMsg = "unable to option ODBC connection for DSN ";
eMsg += dsn; eMsg += dsn;