qt + oracle连接问题 [英] qt + oracle connecting problem

查看:60
本文介绍了qt + oracle连接问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用以下代码连接到Oracle中的数据库:

I'm trying to connect to my db in Oracle with the following code:

#include "mainwindow.h"
#include <QCoreApplication>
#include <QtGui>
#include <QtSql>

int main(int argc, char **argv)
{
    QCoreApplication myApp(argc, argv);

    QSqlDatabase db;
    db.addDatabase("QOCI");
    db.setDatabaseName("RFV75");
    db.setUserName("RFVDB19");
    db.setPassword("RFVB19");
    db.setPort(1521);

    return myApp.exec();
}

但是出现以下错误: QSqlDatabase:未加载QOCI驱动程序 QSqlDatabase:可用的驱动程序:QSQLITE QODBC3 QODBC

but i get the following error: QSqlDatabase: QOCI driver not loaded QSqlDatabase: available drivers: QSQLITE QODBC3 QODBC

我正在使用QT 4.6和QT Creator 2.0 我将.pro文件设置为:

i'm using QT 4.6 and QT Creator 2.0 i set the .pro file to:

QT       += core gui sql

出什么问题了?

推荐答案

您没有将Oracle驱动程序编译到Qt库中.

You don't have an Oracle driver compiled into your Qt libraries.

这可能会有所帮助: 查看全文

登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆