ODBC works on Windows not on MAC



  • 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!



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



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



  • 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]



  • Would have been to easy a solution. ;-)



  • 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..


Log in to reply
 

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