'How to use ODBC in Poco (C++)?
I made the choice to peek Poco (the (too) big C++ library) to handle with ODBC connections.
But after digging into this part of the lib Poco::Data::ODBC, I'm not figuring out if I am missing something or if some documented functions are simply unimplemented.
Documentation to the ODBC namespace : https://docs.pocoproject.org/current/Poco.Data.ODBC.html
For example, SQLTables(...) which is a reimplementation of the Windows ODBC API function of the same signature (Poco has almost all functions named after Windows ODBC Api), looks to be missing. If I use it, I won't get any response.
https://docs.microsoft.com/en-us/sql/odbc/reference/syntax/sqltables-function?view=sql-server-ver15 https://docs.pocoproject.org/current/Poco.Data.ODBC.html#3649
- How do you use ODBC in Poco?
- Do I need to reimplement something, or inherit and specialize?
- Do you have any example using this functions?
#include <iostream>
#include <Poco/Data/SessionFactory.h>
#include <Poco/Data/ODBC/Connector.h>
using namespace Poco::Data;
void main() {
try {
ODBC::Connector::registerConnector();
Session session{ SessionFactory::instance().create(ODBC::Connector::KEY, "Driver={IBM i Access ODBC Driver};SYSTEM=192.168.0.10;DBQ=BASENAME;UID=user;PWD=passwd") };
if (session.isConnected()) {
StatementImpl *hstmt = session.createStatementImpl();
ODBC::SQLTables(hstmt, NULL, 0, NULL, 0, NULL, 0, NULL, 0);
}
}
catch (const Poco::Exception& err) {
std::cerr << "Error thrown: " << err.displayText() << "\n";
}
}
Resulting to the message:
"Error thown: Not implemented"
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
