Before continuing, it is useful to spend a few moments on exception handling in DB with the C++ API.
        By default, most
        
        DB methods throw 
            DbException
            
        in the event of a serious error. 
        
        
        However, be aware that
        DbException does not inherit from
        std::exception so your try
        blocks should catch both types of exceptions. For example:
        
        
    
#include <db_cxx.h>
    ...
try 
{
    // DB and other code goes here
}
catch(DbException &e)
{
  // DB error handling goes here
}
catch(std::exception &e)
{
    // All other error handling goes here
} 
      
        You can obtain the DB error number for a
        DbException 
         
        by using
        
            DbException::get_errno(). 
            You can also obtain the informational message associated with that error
            number using DbException::what().
        
        
    
        If for some reason you do not want to manage
        DbException objects in your
        try blocks, you can configure DB to suppress them
        by setting DB_CXX_NO_EXCEPTIONS for your database and
        environment handles. In this event, you must manage your DB error
        conditions using the integer value returned by all DB methods. Be
        aware that this manual assumes that you want to manage your error
        conditions using DbException objects.