Oracle database connection failure



  • hello,
    I am quite new to Qt and I want to establish connection between Qt and Oracle. I researched various articles even the online Qt documentation. None of them helped and end up with failure to connect Oracle database. Is there anyone can explain step by step guide for dummies to connect with Oracle database? My environment is:
    OS=windows 10
    Qt=5.10
    Database=Oracle 12
    Thanks in advance.



  • @Atiker
    While you're waiting for an expert (not me!), have you tried something like https://stackoverflow.com/questions/3646854/qt-oracle-connecting-problem (assuming that's appropriate to you), and what error do you get?

    From reading, I think you may have to do some Qt compilation to get QOCI driver. https://forum.qt.io/topic/53051/solved-connect-oracle-database-from-qt-creator and http://doc.qt.io/qt-5/sql-driver.html#qoci



  • I don`t know how to set up the environment. Here is the error message in Qt:
    QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QODBC QODBC3 QPSQL QPSQL7
    "Driver not loaded Driver not loaded".



  • @Atiker
    You do not have the QOCI driver available, which is what you will need for Oracle. The above topics discuss this and what you have to do. My reading is that it does not come distributed with Qt (possible copyright reasons), and you have to build it yourself.
    https://stackoverflow.com/questions/17601662/how-to-build-qt-qoci-oracle-database-driver-on-windows-with-mingw
    Unless someone says otherwise....



  • That article doesn`t work on my pc. Here is the mingw command line:
    C:\Qt\5.10.0\Src\qtbase\src\plugins\sqldrivers\oci>set INCLUDE=%INCLUDE%;C:\app\aliati\product\12.2.0\dbhome_1\oci\include

    C:\Qt\5.10.0\Src\qtbase\src\plugins\sqldrivers\oci>set LIB=%LIB%;C:\app\aliati\product\12.2.0\dbhome_1\oci\lib\msvc

    C:\Qt\5.10.0\Src\qtbase\src\plugins\sqldrivers\oci>qmake oci.pro

    C:\Qt\5.10.0\Src\qtbase\src\plugins\sqldrivers\oci>mingw32-make
    mingw32-make -f Makefile.Release
    mingw32-make[1]: Entering directory 'C:/Qt/5.10.0/Src/qtbase/src/plugins/sqldrivers/oci'
    mingw32-make[1]: Nothing to be done for 'first'.
    mingw32-make[1]: Leaving directory 'C:/Qt/5.10.0/Src/qtbase/src/plugins/sqldrivers/oci'

    C:\Qt\5.10.0\Src\qtbase\src\plugins\sqldrivers\oci>



  • @Atiker

    mingw32-make[1]: Entering directory 'C:/Qt/5.10.0/Src/qtbase/src/plugins/sqldrivers/oci'
    mingw32-make[1]: Nothing to be done for 'first'.

    So, have you either looked to see what is already present in that directory, or made sure you've done a full "clean" before building? Why does it say nothing to be done for 'first'? You can look at the makefile.

    Or wait for someone else to come here and tell you exactly what to do.....



  • Let me just reinstall Qt and try it again!:((



  • @Atiker
    Worth a try :)

    Take this with a pinch of salt --- bearing in mind I know nothing --- but:

    set LIB=%LIB%;C:\app\aliati\product\12.2.0\dbhome_1\oci\lib\msvc

    Is that msvc at the end right for mingw? I thought msvc was for Microsoft VC libs? But don't get hung up on this, as it's only something which might look odd to me....



  • There is another error encountered :((
    C:\Qt\5.10.0\mingw53_32>cd C:\Qt\5.10.0\Src\qtbase\src\plugins\sqldrivers\oci

    C:\Qt\5.10.0\Src\qtbase\src\plugins\sqldrivers\oci>set INCLUDE=%INCLUDE%;C:\app\aliati\product\12.2.0\dbhome_1\oci\include

    C:\Qt\5.10.0\Src\qtbase\src\plugins\sqldrivers\oci>set LIB=%LIB%;C:\app\aliati\product\12.2.0\dbhome_1\oci\lib\msvc

    C:\Qt\5.10.0\Src\qtbase\src\plugins\sqldrivers\oci>qmake oci.pro
    Cannot read C:/Qt/5.10.0/Src/qtbase/src/plugins/sqldrivers/qtsqldrivers-config.pri: The system cannot find the file specified.
    Project ERROR: Library 'oci' is not defined.

    AnyHelp.exec();


  • Moderators

    @Atiker You can't use libraries for MSVC compiler with MinGW and other way around.



  • Is there any other appropriate method to build QOCI driver?



  • @Atiker said in Oracle database connection failure:

    Project ERROR: Library 'oci' is not defined.

    Have you taken a look at this post?

    Also this bug report may help you.

    Just in case, have you have properly installed Oracle supporting libraries?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.