Results 1 to 8 of 8

Thread: "QMYSQL: unable to connect"

  1. #1
    Join Date
    Oct 2010
    Posts
    5
    Qt products
    Qt4
    Platforms
    Windows

    Default "QMYSQL: unable to connect"

    Hi, I'm having problems connecting to my MySQL server. It works fine with the localhost (XAMPP), but I get an error when I try to connect to the one of my one.com webserver. I'm sure my access data is right (as I'm using it with several CMS), but QSqlDatabase:pen() always fails with "Can't connect to MySQL server on 'anteevy.de' (10060) QMYSQL: Unable to connect".

    Any ideas?

  2. #2
    Join Date
    Dec 2008
    Location
    Poland
    Posts
    383
    Thanks
    52
    Thanked 42 Times in 42 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: "QMYSQL: unable to connect"

    If You are sure that there is no error in the code, then that's probably because host company that Your web page is hosted on don't allow connection to the DB from the external IP (due to security reasons).
    In the near future - corporate networks reach out to the stars. Electrons and light flow throughout the universe.
    The advance of computerization however, has not yet wiped out nations and ethnic groups.

  3. #3
    Join Date
    Jan 2008
    Location
    Davao City, Philippines
    Posts
    77
    Thanks
    16
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: "QMYSQL: unable to connect"

    Try 'mysql -h anteevy.de -u username -p password' and see, if you can get a connection. Don't forget to replace username and password.

  4. #4
    Join Date
    Oct 2010
    Posts
    5
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: "QMYSQL: unable to connect"

    Okay, I guess it's not Qt related. I get the same errors with the command line. When using "anteevy.de" as the mysql host, I get "can't connect to mysql server" and with "anteevy.de.mysql" (that's what I'm using as host name in several CMS) I directly get a "unknown mysql server host". Is there something I would have to append to that? Something like mysql:// (no idea?)?

  5. #5
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: "QMYSQL: unable to connect"

    No it is like it was said: Provider only allow access to their databases from scripts which run on their servers. That's the normal way. Or do you have a remote server, then you possible are allowed to access from everywhere. But simply have a look at the privileges your mysql user has. There is defined from which host your user is allowed to connect. Or ask your provider.

  6. #6
    Join Date
    Dec 2008
    Location
    Poland
    Posts
    383
    Thanks
    52
    Thanked 42 Times in 42 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: "QMYSQL: unable to connect"

    @anteevy
    When Host company block You external DB access there is one thing You can do to get it to work, that is create PHP script that will take as arg SQL query and response request result (or JSON/XML whatever You really want).
    In the near future - corporate networks reach out to the stars. Electrons and light flow throughout the universe.
    The advance of computerization however, has not yet wiped out nations and ethnic groups.

  7. #7
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: "QMYSQL: unable to connect"

    Quote Originally Posted by Talei View Post
    @anteevy
    When Host company block You external DB access there is one thing You can do to get it to work, that is create PHP script that will take as arg SQL query and response request result (or JSON/XML whatever You really want).
    And then you only have to wait till the provider closes your account since that is against the contract rules. (at least against the common rules for web hosts.)

  8. #8
    Join Date
    Dec 2008
    Location
    Poland
    Posts
    383
    Thanks
    52
    Thanked 42 Times in 42 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: "QMYSQL: unable to connect"

    Well that depends on the contract that You have with host companies, so when You do something like that You need to know what's "Do" and "Do Not".
    And basically connection is made to DB from localhost, so I doubt that they will monitor scripts, and how would they know if access is not done for internal WEB purpose?
    I mean how would they know that You use external prog. and not the Web Browser to hit the page? (It's simply GET or POST HTTP request)
    In the near future - corporate networks reach out to the stars. Electrons and light flow throughout the universe.
    The advance of computerization however, has not yet wiped out nations and ethnic groups.

Similar Threads

  1. Replies: 9
    Last Post: 20th May 2010, 09:55
  2. Another "QMYSQL" problems thread
    By Lorthirk in forum Newbie
    Replies: 1
    Last Post: 27th September 2009, 17:44
  3. Replies: 5
    Last Post: 19th April 2009, 13:24
  4. The strange problem:"QSqlDatabase: QMYSQL driver not loaded"
    By osmanthus in forum Installation and Deployment
    Replies: 2
    Last Post: 22nd January 2009, 15:12
  5. Translation QFileDialog standart buttons ("Open"/"Save"/"Cancel")
    By victor.yacovlev in forum Qt Programming
    Replies: 4
    Last Post: 24th January 2008, 19:05

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.