SQLAPI++连接不到Oracle数据库
我想在QT中用SQLAPI++连接上Oracle数据库,但是每次都不行,都会抛出异常,检查ErrText()返回的总是一个"o",想问一下这是为啥。
#include "mainwindow.h"
#include <QApplication>
#include <QDebug>
#include <SQLAPI.h>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
SAConnection con;
try {
con.Connect("ORCL", "scott", "tiger", SA_Oracle_Client);
qDebug()<<QObject::tr("connected!");
/*
The rest of the tutorial goes here!
*/
con.Disconnect();
qDebug()<<QObject::tr("disconnected!");
}
catch(SAException &x) {
con.Rollback();
qDebug()<<QObject::tr(x.ErrText());
}
w.show();
return a.exec();
}