tags:

views:

90

answers:

2

Hi,

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();
}

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

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

QT       += core gui sql

what's the problem ?

+1  A: 

You probably haven't linked the Oracle driver to your executable.

Andre Holzner
how can i do it ?
kaycee
+1  A: 

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

This might help: QOCI for the Oracle Call Interface (OCI)

PiedPiper
now that i have the plugin how i combine it with my program ?
kaycee
If you've compiled it and installed it, it should be loaded automatically when needed. Have you looked at the 'Troubleshooting' section in the documentation at the link?
PiedPiper