changed SimpleConnectionManager to properly raise an exception when
the ODBC data source can not be found
This commit is contained in:
parent
6398a28317
commit
d2f1979923
1 changed files with 9 additions and 4 deletions
|
@ -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;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue