I'm trying hard to connect to a PostgreSQL database on another server. Here is my code:
- Code: Select all
#include "Poco/Data/ODBC/Connector.h"
#include "Poco/Data/Session.h"
#include "Poco/Data/SessionFactory.h"
int main(int argc, char** argv)
{
Poco::Data::ODBC::Connector::registerConnector();
Poco::Data::Session dbSession(Poco::Data::SessionFactory::instance().create("ODBC", "DRIVER=PostgreSQL ANSI; SERVER=...; DATABASE=...; UID=...; PWD=..."));
Poco::Data::ODBC::Connector::unregisterConnector();
return 0;
}
which I then compile with
- Code: Select all
g++ src/main.cpp -o main -Wall -lPocoXML -lPocoODBC
On execution I get the following error:
- Code: Select all
jm[core]$ ./main
terminate called after throwing an instance of 'Poco::Data::ODBC::HandleException'
what(): ODBC handle exception
Aborted
Any ideas?





