Results 1 to 4 of 4

Thread: Creating MySQL and Oracle (OCI) plugins.

  1. #1
    Join Date
    May 2010
    Location
    Lexington, KY
    Posts
    7
    Thanks
    1
    Qt products
    Qt4 Qt Jambi
    Platforms
    Windows

    Angry Creating MySQL and Oracle (OCI) plugins.

    Environment:

    Windows 7 x64 Ultimate
    Visual Studio 2008 w/ Qt Integration
    Qt 4.6.2 libraries VS2008
    • configure (no other switches)

    ABSTRACT:

    I have Qt configured and built already. I have working examples and everything appears fine. What I now is to build the MySQL and the Oracle OCI plugins. I have downloaded the required sources for both databases. (the include, lib)
    I have followed the Qt Documentation for building the plugins but I get LNK errors for both builds. Below is the error I get for building MySQL plugin. The Oracle one is very similar.
    Qt Code:
    1. ..\..\..\..\plugins\sqldrivers\qsqlmysqld4.dll : fatal error LNK1120: 50 unresol
    2. ved externals
    3. NMAKE : fatal error U1077: '"c:\My Programs\Microsoft Visual Studio 9.0\VC\BIN\l
    4. ink.EXE"' : return code '0x460'
    5. Stop.
    6. NMAKE : fatal error U1077: '"c:\My Programs\Microsoft Visual Studio 9.0\VC\BIN\n
    7. make.exe"' : return code '0x2'
    8. Stop.
    To copy to clipboard, switch view to plain text mode 

    Any help would be greatly appreciated. What am I doing wrong?

    -Blando

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Creating MySQL and Oracle (OCI) plugins.

    The MySQL and Oracle link libraries are not being found by the linker. Related error messages should be showing above the snippet you posted.

    You need to put the MySQL/Oracle bin or lib directories in the linker's library search path. The VC++ linker can be told to look in other places using the LIB environment variable or /LIBPATH command line option. If this were your own project you could adjust the LIBS variable in your PRO file.

  3. The following user says thank you to ChrisW67 for this useful post:

    Blando (15th May 2010)

  4. #3
    Join Date
    May 2010
    Location
    Lexington, KY
    Posts
    7
    Thanks
    1
    Qt products
    Qt4 Qt Jambi
    Platforms
    Windows

    Unhappy Re: Creating MySQL and Oracle (OCI) plugins.

    I think I have already done this.

    Starting from scratch just trying to build OCI.

    Qt Code:
    1. cd c:\Qt\4.6.2\sql\plugins\sqldrivers\oci
    2. qmake oci.pro
    To copy to clipboard, switch view to plain text mode 
    • Results in: "Cannot open include file: 'oci.h' ...." <---GOOD

    Qt Code:
    1. nmake distclean
    2. set include=%include%c:\Oracle\sdk\include;
    3. qmake oci.pro
    4. nmake
    To copy to clipboard, switch view to plain text mode 
    • Results in: "fatal error LNK1104: cannot open file 'oci.lib'......" <---GOOD

    Finally,
    Qt Code:
    1. nmake distclean
    2. set lib=%lib%c:\Oracle\sdk\lib\msvc;
    3. qmake oci.pro
    4. nmake
    To copy to clipboard, switch view to plain text mode 
    • ..\..\..\..\plugins\sqldrivers\qsqlocid4.dll : fatal error LNK1120: 29 unresolved externals
      NMAKE : fatal error U1077: '"c:\My Programs\Microsoft Visual Studio 9.0\VC\BIN\link.EXE"' : return c
      ode '0x460'
      Stop.
      NMAKE : fatal error U1077: '"c:\My Programs\Microsoft Visual Studio 9.0\VC\BIN\nmake.exe"' : return
      code '0x2'
      Stop.



    I'm not sure what else I need to do. I have done everything in the documentation.
    I also added c:\Oracle to PATH and still get the 29 unresolved externals problem.

    I am using the Oracle Instant Client Basic (c:\Oracle) and Oracle Instant Client SDK (c:\Oracle\sdk)

    I believe if I can get this resolved then I will be able to fix MySQL as well. Similar issues for both.

    A foot in the right direction would be great.

    Thanks.
    -Blando

  5. #4
    Join Date
    May 2010
    Location
    Lexington, KY
    Posts
    7
    Thanks
    1
    Qt products
    Qt4 Qt Jambi
    Platforms
    Windows

    Wink Re: Creating MySQL and Oracle (OCI) plugins.

    Marvelous.

    SOLVED:

    My problem was that I wasn't using the correct version and/or I had a version mismatch.

    I deleted my entire c:\Oracle and started fresh.

    I followed The Oracle God, Mark Williams, tutorial here.

    I did exactly what he stated, using the older version 11.1.0.6.0
    • Download Oracle Instant Client BASIC x32 11.1.0.6.0

    • Download Oracle Instant Client SDK x32 11.1.0.6.0

    • Download Oracle C++ Call Interface Visual C++ 9 (VS 2008) x32


    I built his sample code to make sure everything was right. Once I was able to build successfully then I went to Qt.


    Visual Studio Command Line
    cd c:\Qt\4.6.2\src\plugins\sqldrivers\oci
    set include=%include%c:\Oracle\sdk\include;
    set lib=%lib%c:\Oracle\sdk\lib\msvc\vc9;
    set path=%path%c:\Oracle\vc9; <--directory you will create from Mark Williams instructions posted above.
    set path=%path%c:\Oracle;
    qmake oci.pro
    nmake
    Error Free!!

    Created sample Qt app to test.
    Qt Code:
    1. #include "oci_test_app.h"
    2. #include <QtGui/QApplication>
    3. #include <QSqlDatabase>
    4. #include <QSqlError>
    5. #include <QMessageBox>
    6.  
    7. bool createConnection()
    8. {
    9. QSqlDatabase db = QSqlDatabase::addDatabase("QOCI");
    10. db.setHostName("test");
    11. db.setDatabaseName("test");
    12. db.setUserName("test");
    13. db.setPassword("test");
    14. if(!db.open())
    15. {
    16. QMessageBox::critical(0, QObject::tr("Database Error"), db.lastError().text());
    17. return false;
    18. }
    19.  
    20. }
    21. int main(int argc, char *argv[])
    22. {
    23. QApplication a(argc, argv);
    24. if(!createConnection())
    25. return 1;
    26. OCI_TEST_APP w;
    27. w.show();
    28. return a.exec();
    29. }
    To copy to clipboard, switch view to plain text mode 
    No errors on build. Error free compilation.
    Got the Oracle Error Message on run. <-- GOOD
    Now we are set to go.

    -Blando

Similar Threads

  1. problem creating a mysql database
    By TonyB in forum Qt Programming
    Replies: 10
    Last Post: 23rd July 2010, 15:39
  2. Replies: 5
    Last Post: 25th September 2009, 14:03
  3. Issues creating MySql Plugin on Windows
    By NicholasSmith in forum Installation and Deployment
    Replies: 2
    Last Post: 29th April 2009, 09:04
  4. Problem with nmake and mysql plugins
    By raken in forum Installation and Deployment
    Replies: 1
    Last Post: 7th July 2007, 08:20
  5. Need to compile with MySQL drivers/plugins
    By mongenix in forum Newbie
    Replies: 5
    Last Post: 6th January 2007, 20:24

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.