我使用SAConnect连接Oracle的时候用户名密码和数据库名称都是正确的,但是总是抛出异常,检查异常信息就是一个"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();
}
我用QT做的,没有报错,但是抛出异常,连接不上数据库。