Results 1 to 19 of 19

Thread: odbc/connection problem

  1. #1
    Join Date
    Jan 2008
    Posts
    33
    Thanks
    1
    Thanked 2 Times in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default odbc/connection problem

    i cant connect to database....

    i need to copy this .dll first even if i use -static in configure and build sub-src:

    (if i copy this .dlls my program runs and work properly my problem is the "qsqlodbc4.dll")
    QTCore4.dll
    QTSql4.dll

    plus
    qsqlodbc4.dll with the folders from its destination.. ex: qsqlodbc4.dll is in C:\QT\4.3.2\plugin\drivers i need to copy the folders too (even w/out the other files, i only need the folders) then put the qsqlodbc4.dll in the directory.. y is it like that??

    note: " if i erase one of these .dll's my connection fails, if i remove the qsqlodbc4.dll in its path even if i dont erase it, my connection will fails"

    i use this connection

    QSqlDatabase db = QSqlDatabaseName("QODBC");
    etc..

    how to make an executable file that connects to the database that dont require these 3 .dll's ?

    note: "I already use "-static" the exe runs but the connection fails"
    do i need to use -plugin-sql-odbc? or just include it in my codes in the program... if yes how?

    thanks...
    Last edited by triperzz; 18th January 2008 at 15:07.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: odbc/connection problem

    Quote Originally Posted by triperzz View Post
    qsqlodbc4.dll with the folders from its destination.. ex: qsqlodbc4.dll is in C:\QT\4.3.2\plugin\drivers i need to copy the folders too (even w/out the other files, i only need the folders) then put the qsqlodbc4.dll in the directory.. y is it like that??
    You can put the plugin in sqldrivers subdirectory in the directory with your application.

    Quote Originally Posted by triperzz View Post
    do i need to use -plugin-sql-odbc? or just include it in my codes in the program... if yes how?
    You can compile the plugin into Qt using -qt-sql-odbc switch or use static plugins.

  3. #3
    Join Date
    Jan 2008
    Posts
    33
    Thanks
    1
    Thanked 2 Times in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: odbc/connection problem

    note: "if i run my program in my computer that has qt in it it runs and connect to database, but when im running my program in a computer that has no qt installed in it.. it runs but cant connect to database"

    So u mean qsqlodbc4.dll is already a plugin for odbc??...

    "You can put the plugin in sqldrivers subdirectory in the directory with your application"

    i already do that, but connection fails, the qsqlodbc4.dll needs to be in c:qt/4.3.2/.../plugin/drivers, but if i dont have qt installed, this directory dont exist and i have to make it first and move qsqlodbc4.dll to it (then my program will run). Only the two other .dll' s are apllicable for relocating.. QTCore4.dll and QTSql4.dll with the application

    how to solve this??

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: odbc/connection problem

    Quote Originally Posted by triperzz View Post
    So u mean qsqlodbc4.dll is already a plugin for odbc??...
    Yes, that's a plugin with QODBC driver.

    Quote Originally Posted by triperzz View Post
    how to solve this??
    Put it in the right directory, just as documentation says, or compile it into your application or Qt.

    What directory do you install your application in?

  5. #5
    Join Date
    Jan 2008
    Posts
    33
    Thanks
    1
    Thanked 2 Times in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: odbc/connection problem

    Quote Originally Posted by jacek View Post
    Yes, that's a plugin with QODBC driver.

    Put it in the right directory, just as documentation says, or compile it into your application or Qt.
    i can use this if it is in the c:qt\4.3.2\.....\drivers (so u mean to say that i have to put the qsqlodbc4.dll here) if a computer dont have qt installed this dir/doesnt exist...

    to run my program in computer that dont have qt ( i do this):

    1 copy the exe file

    2 copy the QTCore4.dll and QTSql4.dll (can be with the application)

    3 make the dir... c:qt\4.3.2\......\drivers

    4 copy the qsqlodbc4.dll

    5 move the qsqlodbc4.dll to the dir i make (in number 3)

    note: " if i dont do 2-5 steps my program will 'run' but connection to 'database' fails"

    6 then my program will run and connect to database

    my question is: is it posible to remove number 2-5 step??...

    just copy the exe file and run...

    1. it will run even without the .dlls required to run the program files (i made this by -static)

    2. it will connect to database even without (.dlls that connects to database) QTCore4.dll, QTSql4.dll and qsqlodbc4.dll ( i dunno how)

    can i build my apllication that will add this .dlls (QTCore4.dll, QTSql4.dll and qsqlodbc4.dll) internaly so that it will nolonger require this .dlls..?
    Last edited by triperzz; 18th January 2008 at 18:36.

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: odbc/connection problem

    Quote Originally Posted by triperzz View Post
    1 copy the exe file
    Where do you copy that file exactly?

    Quote Originally Posted by triperzz View Post
    can i build my apllication that will add this .dlls (QTCore4.dll, QTSql4.dll and qsqlodbc4.dll) internaly so that it will nolonger require this .dlls..?
    Yes, you already asked that question and the answer is still the same: link your application statically.

  7. #7
    Join Date
    Jan 2008
    Posts
    33
    Thanks
    1
    Thanked 2 Times in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: odbc/connection problem

    Quote Originally Posted by jacek View Post
    Where do you copy that file exactly?
    in the folder of my project.. after i build it, QDEVELOP will build an exe file. That exe file is the one that i copy.. is that right??

    Quote Originally Posted by jacek View Post
    Yes, you already asked that question and the answer is still the same: link your application statically.
    how?....

    i do it in cmd.. configure -static-release -no-exection then mingw32-make sub-src (is this right?)

  8. #8
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: odbc/connection problem

    Quote Originally Posted by triperzz View Post
    in the folder of my project.. after i build it, QDEVELOP will build an exe file. That exe file is the one that i copy.. is that right??
    OK, let me put it in another way: If you copy your application to C:\xxx then you have to place qsqlodbc4.dll in c:\xxx\sqldrivers directory.

    Quote Originally Posted by triperzz View Post
    i do it in cmd.. configure -static-release -no-exection then mingw32-make sub-src (is this right?)
    If it compiles, then it's OK. You can add -qt-sql-odbc switch to get rid of the plugin.

  9. #9
    Join Date
    Jan 2008
    Posts
    33
    Thanks
    1
    Thanked 2 Times in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: odbc/connection problem

    Quote Originally Posted by jacek View Post
    OK, let me put it in another way: If you copy your application to C:\xxx then you have to place qsqlodbc4.dll in c:\xxx\sqldrivers directory.
    thanks!! i dont really understand it when you first post this reply... now i understand, and it works...

    Quote Originally Posted by jacek View Post
    If it compiles, then it's OK. You can add -qt-sql-odbc switch to get rid of the plugin.
    i will try this one now.. in cmd qt\...>configure <command> (right??)

    thanks again...

  10. #10
    Join Date
    Jan 2008
    Posts
    33
    Thanks
    1
    Thanked 2 Times in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: odbc/connection problem

    my app still require's the .dlls files even if i execute the -static in config??

    maybe my steps in making my program static are wrong can you please help me...

    my steps are:

    in cmd

    1. c:\qt\4.3.2>configure -static -release -no-exceptions

    2. c:\qt\4.3.2>mingw32-make sub-src

    3. c:\qt\4.3.2>configure -saveconfig

    is their something im missing?

    when i run this i think im just rerunning the configure.exe (i first run this for my libraries after the installation then now rerun it for -static -release)

    plz give me some guide to do this right...

  11. #11
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: odbc/connection problem

    Quote Originally Posted by triperzz View Post
    my app still require's the .dlls files even if i execute the -static in config??
    Which ones? How do you compile your application?

  12. #12
    Join Date
    Jan 2008
    Posts
    33
    Thanks
    1
    Thanked 2 Times in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: odbc/connection problem

    Quote Originally Posted by jacek View Post
    Which ones?
    same .dlls and now with the Gui4.dll.

    Quote Originally Posted by jacek View Post
    How do you compile your application?
    i just compile it in QDevelop..
    i dont no if thats right?i compile it after i run the configure -static in cmd... i dont know how to -static my proj... plz help me how..

  13. #13
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: odbc/connection problem

    Quote Originally Posted by triperzz View Post
    same .dlls and now with the Gui4.dll.
    Do you have Qt installed in more than one place?

    Quote Originally Posted by triperzz View Post
    i just compile it in QDevelop..
    i dont no if thats right?
    Make sure QDevelop is using qmake from the static Qt build.

  14. #14
    Join Date
    Jan 2008
    Posts
    33
    Thanks
    1
    Thanked 2 Times in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: odbc/connection problem

    Quote Originally Posted by jacek View Post
    Do you have Qt installed in more than one place?
    none, i just install qt and mingw.. plus I just save my project in desktop.

    Quote Originally Posted by jacek View Post
    Make sure QDevelop is using qmake from the static Qt build
    how?

  15. #15
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: odbc/connection problem

    Quote Originally Posted by triperzz View Post
    how?
    I don't use QDevelop, but there should be some dialog that allows you to configure paths to all of the tools you need to compile your application. Since you have just one installation of Qt, the paths should be OK.

    What files do you have in c:\qt\4.3.2\lib folder? How big are the .a files?

  16. #16
    Join Date
    Jan 2008
    Posts
    33
    Thanks
    1
    Thanked 2 Times in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: odbc/connection problem

    Quote Originally Posted by jacek View Post
    What files do you have in c:\qt\4.3.2\lib folder? How big are the .a files?
    in my c:qt\4.3.2\lib have .a files, some are 1mb - less the biggest is 9 mb for ui...


    how can i make my app static? step by step plz i think im missing something...

  17. #17
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: odbc/connection problem

    Quote Originally Posted by triperzz View Post
    in my c:qt\4.3.2\lib have .a files, some are 1mb - less the biggest is 9 mb for ui...
    So it seems that you have the right libraries.

    Have you tried rebuilding your project from scratch?

  18. #18
    Join Date
    Jan 2008
    Posts
    33
    Thanks
    1
    Thanked 2 Times in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: odbc/connection problem

    Quote Originally Posted by jacek View Post
    So it seems that you have the right libraries.

    Have you tried rebuilding your project from scratch?
    yes but its the same...

    im gonna try to reconfigure the qt in cmd

    and try to right this: c:/./..>configure -static -release -qt-sql-odbc -saveconfig

    and after long loading and reading......

    c:/././..> mingw32-make

    hope this work!..
    Last edited by triperzz; 22nd January 2008 at 13:40.

  19. #19
    Join Date
    Jan 2008
    Posts
    33
    Thanks
    1
    Thanked 2 Times in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Cool Re: odbc/connection problem

    i try the codes above...

    and at last it works...

    my app is now static even with sql..

Similar Threads

  1. Tricky problem with ARGB widget / UpdateLayeredWindow
    By nooky59 in forum Qt Programming
    Replies: 3
    Last Post: 21st February 2008, 10:35
  2. [QMYSQL] connection problem
    By chaos_theory in forum Installation and Deployment
    Replies: 5
    Last Post: 2nd July 2007, 09:52
  3. Grid Layout Problem
    By Seema Rao in forum Qt Programming
    Replies: 2
    Last Post: 4th May 2006, 12:45
  4. fftw problem
    By lordy in forum General Programming
    Replies: 1
    Last Post: 16th March 2006, 21:36
  5. Replies: 16
    Last Post: 7th March 2006, 15:57

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.