Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. ODBC works on Windows not on MAC
Qt 6.11 is out! See what's new in the release blog

ODBC works on Windows not on MAC

Scheduled Pinned Locked Moved General and Desktop
6 Posts 3 Posters 4.3k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I Offline
    I Offline
    Iktwo
    wrote on last edited by
    #1

    Hi, I'm developing a Qt application that uses MySQL, I haven't managed to connect to MySQL from a MAC so I was thinking that ODBC would be easiear for me. I tested my application with direct connection to MySQL on linux and it works, on Windows I'm accesing MySQL trough ODBC also works, but on MAC it doesn't, do I have to change something in my connection string?

    @
    bd = QSqlDatabase::addDatabase("QODBC");

    "DRIVER={MySQL ODBC 5.1 Driver};DATABASE=ccomputo;SERVER=127.0.0.1;"

    bd.setUserName("test");
    bd.setPassword("test");
    @

    that´s how I connect on Windows, thanks!

    1 Reply Last reply
    0
    • L Offline
      L Offline
      leon.anavi
      wrote on last edited by
      #2

      Do you get any kind of error on your MAC when you try to connect to the MySQL database?

      http://anavi.org/

      1 Reply Last reply
      0
      • M Offline
        M Offline
        mkae
        wrote on last edited by
        #3

        Looking at the code above I'd say you should type bd.setPassword() instead of bd.setPasword().

        1 Reply Last reply
        0
        • I Offline
          I Offline
          Iktwo
          wrote on last edited by
          #4

          I will look tomoroow (I don't have a MAC here :( )
          [quote author="leon.anavi" date="1307997312"]Do you get any kind of error on your MAC when you try to connect to the MySQL database?[/quote]

          That's was a typo as I didn't copy & paste the code, what I was trying to say is that my code compiles, the driver is activated, but I can't connect to my database on mac.. that code works in windows, thanks!
          [quote author="mkae" date="1308001015"]Looking at the code above I'd say you should type bd.setPassword() instead of bd.setPasword().[/quote]

          1 Reply Last reply
          0
          • M Offline
            M Offline
            mkae
            wrote on last edited by
            #5

            Would have been to easy a solution. ;-)

            1 Reply Last reply
            0
            • I Offline
              I Offline
              Iktwo
              wrote on last edited by
              #6

              The error is!

              [iODBC][Driver Manager]dlopen(/usr/local/lib/libmyodbc5.so, 6): no suitable image found. Did find: /usr/local/lib/libmyodbc5.so: mach-o, but wrong architecture [iODBC][Driver Manager]Specified driver could not be loaded QODBC3: Unable to connect

              Edit:
              I reinstalled the driver and now I can connect, but I can't access my data, I see no errors, but when I try to execute a simple SELECT * FROM Users it doesn't show a thing.. of course I have users in the database.. If I do an UPDATE or a DELETE it works :S! is my driver messed up or something? my connection is working cause I can insert or delete..

              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved