Results 1 to 7 of 7

Thread: Oracle Database Connection

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Ohio
    Posts
    332
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Thanks
    37
    Thanked 8 Times in 4 Posts

    Cool Re: Oracle Database Connection

    I was able to manually build the driver on my own. I went to the $QTDIR/src/plugins/sqldrivers/oci directory. I then ran

    $QTDIR/bin/qmake -o Makefile "INCLUDEPATH+=$ORACLE_HOME/rdbms/public" "LIBS+=-L$ORACLE_HOME/lib32" oci.pro

    Then I ran make and it all worked well. The library was copied into $QTDIR/plugins/sqldrivers.

    Inside my program's makefile I added these lines and also modified my LD_LIBRARY_PATH inside my .cshrc and re-sourced the .cshrc:

    In the INC variable I added the line: -I$(QT)/include/QtSql
    In the LIBS variable I added the line: -lQtSql
    In the LIBHOMES variable I added the line: -L$(QT)/plugins/sqldrivers

    I did a make clean followed by a make and everything compiled and linked correctly. But when I ran the program and tried to create a QSqlDatabase I got some printout errors. I first tried to create the database with the line

    Qt Code:
    1. QSqlDatabase db = QSqlDatabase( "QOCI" );
    To copy to clipboard, switch view to plain text mode 

    The errors that print out are:

    QSqlDatabase: QOCI driver not loaded
    QSqlDatabse: available drivers:
    According to this there are no database drivers installed anywhere. Is there something else I need to do to let the program or Qt know I made the QOCI driver? Thanks!

  2. #2
    Join Date
    Jan 2006
    Location
    Ohio
    Posts
    332
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Thanks
    37
    Thanked 8 Times in 4 Posts

    Default Re: Oracle Database Connection

    Looking at other posts, it seems I have to make a QApplication to get the plugins. Is this correct? I will look into doing this. Thanks!

    Edit: Well I added the QApplication creation call into my main. I made it the VERY first line in main so it would be created right away. Now whenever I try to open the database, it says I don't have OCI support. It says I do have the QSQLLite driver but that is it. I look in the /plugins/sqldrivers directory and it has 2 drivers there, the oci and sqllite drivers. How do I get Qt to recognize the oci driver. I have multiple copies of Qt, but I have set everything up to look at the one with the driver. What do I need to do to make Qt recognize the OCI driver? Thanks!!
    Last edited by ToddAtWSU; 20th December 2007 at 17:00.

Similar Threads

  1. Threads and database connection
    By probine in forum Qt Programming
    Replies: 9
    Last Post: 7th August 2013, 09:30
  2. Client/Server Error: BadIDChoice
    By 3nc31 in forum Qt Programming
    Replies: 5
    Last Post: 27th November 2007, 11:22
  3. Insertion of unicode characters into database oracle through pro c
    By hemananda choudhuri in forum Qt Programming
    Replies: 1
    Last Post: 8th January 2007, 11:42
  4. Qt and MySQL Database Connection
    By shamik in forum Qt Programming
    Replies: 41
    Last Post: 6th October 2006, 13:48
  5. Oracle Database Problem
    By magikalpnoi in forum Qt Programming
    Replies: 3
    Last Post: 27th September 2006, 22:19

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.