linux qt QODBC连接sql server 驱动 问题 ,实在是没辙了
程序在linux下,现在需要连接windows的sqlserver .
db = QSqlDatabase::database(SqlExpressway);
if ( db.isValid() == false )
{
db = QSqlDatabase::addDatabase("QODBC", SqlExpressway);
QString dsn = QString("DRIVER={SQL SERVER};SERVER=%1;port=%2;DATABASE=%3;uid=%4;pwd=%5;")
.arg("192.168.1.214")
.arg(1344)
.arg("expressway")
.arg("sa")
.arg("");
db.setDatabaseName(dsn);
db.setHostName("192.168.1.214");
db.setPort(1344);
db.setUserName("sa");
db.setPassword("");
if ( db.open() == false )
{
db.removeDatabase(SqlExpressway);
qDebug()<<"error:"<<db.lastError().text();
}
}
qDebug() << "Available drivers:";
QStringList drivers = QSqlDatabase::drivers();
foreach(QString driver, drivers)
qDebug() << "\t" << driver;
error:"Driver not loaded Driver not loaded"