-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Description
I use the ODBC database interface code as follows:
std::string dbConnString= Poco::format("DRIVER=%s;UID=%s;PWD=%s;DATABASE=%s;SERVER=%s;PORT=%s;", driver, user, pwd, db, serv, port);
std::shared_ptr<Poco::Data::SessionPool > m_pSessionPool = std::make_sharedPoco::Data::SessionPool(Poco::Data::ODBC::Connector::KEY, dbConnString);
Poco::Data::Session trackSess(m_pSessionPool->get());
......
trackSess << ... << Poco::Data::Keywords::now;
......
An error is reported after running the program for a period of time: not connected to data source.Next, perform the reconnection process:
trackSess.reconnect();
......
The program threw an exception. Because reconnect() call close() and set _pHolder = 0,then open() will throw the wrong exception.If there is an error in a connection in the database connection pool, such as network exception, what should I do to connect to the database again