#include "Poco/exception.h"
#include "Poco/data/session.h"
#include "Poco/data/common.h"
#include "Poco/data/blob.h"
#include "poco/data/statementimpl.h"
#include "poco/data/sessionpool.h"
#include "poco/data/pooledsessionimpl.h"
#include "Poco/data/mysql/connector.h"
#include "Poco/data/mysql/mysqlexception.h"
#include "Poco/data/sqlite/connector.h"
#include "Poco/data/sqlite/sqliteexception.h"
#include "Poco/data/odbc/connector.h"
#include "Poco/data/odbc/odbcexception.h"
#include <iostream>
#include "Poco/data/common.h"
#include "poco/data/sessionpool.h"
#include "Poco/thread.h"
int main ()
{
Try
{
Poco::D ata::mysql::connector::registerconnector ();
Poco::D ata::sessionpool Pool ("MySQL", "user=root;password=;d b=calserver;compress=true;auto-reconnect=true", 1, 4, 5 );
Poco::D ata::session sess (Pool.get ());
if (sess.isconnected ())
{
int count = 0;
sess<< "Select COUNT (*) from Termstate", Poco::D ata::into (COUNT), Poco::D ata::now;
Std::cout << "The sum is:" << count << "Recorder" <<std::endl;
}
Else
{
Std::cout << "* * Connected to DB"
<< "Failed" <<std::endl;
}
Poco::D ata::mysql::connector::unregisterconnector ();
}
catch (Poco::exception &ex)
{
Std::cerr << ex.displaytext () << Std::endl;
}
return 0;
}
Makefile file refer to another Boventon with the makefile template, needs to be modified for the place:
# # Customizable Section:adapt those variables to suit your program.
##==========================================================================
# The Pre-processor and compiler options.
My_cflags =-i/usr/local/include/
# The linker options.
My_libs =-l/usr/local/lib/-lpocodatamysql-lpocoutil