标签:取数 drive esc *** img server info pen else
驱动动态库:kdbodbcw.so
依赖动态库:libkci.so.5
sudo apt install odbcinst -y
[KingbaseES]
Description = KingbaseES Driver
Driver = /opt/KingbaseES/kdbodbcw.so
Setup = /opt/KingbaseES/libkci.so.5
Debug = 0
CommLog = 1
#include <QtSql/QSqlDatabase>
#include <QtSql/QSqlError>
#include <QtCore/QDebug>
int main(void)
{
QString driver = "KingbaseES"; // 此名称和 odbcinst.ini 中的名称相同【KingbaseES】
QString server = "IP Address";
QString database = "TEST";
QString username = "***"; // 用户名
QString password = "***"; // 密码
QString dsn = QString("Driver={%1};Server=%2;Database=%3;Uid=%4;Password=%5;Port=%6") .arg(driver) .arg(server) .arg(database) .arg(username) .arg(password) .arg(54321);
QSqlDatabase db = QSqlDatabase::addDatabase("QODBC");
db.setDatabaseName(dsn);
if (db.open())
qDebug() << "connect successful";
else
qDebug() << db.lastError().text();
return 0;
}
标签:取数 drive esc *** img server info pen else
原文地址:https://www.cnblogs.com/xklsm/p/14785591.html