Results 1 to 6 of 6
  1. #1
    Join Date
    Oct 2014
    Posts
    2

    Unanswered: VFP to MySQL: Unable to connect? Any suggestions?

    I am unable to connect to a MySQL database using the sqlstringconnect function from VFP. However, I am able to set-up an ODBC connection using the "MySQL ODBC 5.3 ANSI Driver" and can connect just fine? Can anyone provide insight as to what I am missing? Why the difference between the two and is there anyway to get detailed information in an error log?

    Any help would be greatly appreciated.

    Thanks

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    what are you trying that ins't working
    if you can connect via ODBC does it matter. IDBC is supposed to be the generic connector between datastores and application languages / front ends WHERE there is no native driver provided
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Oct 2014
    Posts
    2

    VFP to MySQL

    Thanks Healdem for replying, sorry I failed to state the specifics, here is what I have tried.

    From the ODBC Data Source Administrator, I am able to set-up an ODBC connection using the same driver "MySQL ODBC 5.3 ANSI Driver" and the ODBC connects when tested from the ODBC administrator panel.

    From VFP, the sqlconnect function using the ODBC I just created return a negative value.

    lnConnection = sqlconnect('mysqlodbc')

    From VFP, the sqlstringconnect function returns a negative value using the "MySQL ODBC 5.3 ANSI Driver", therefore no connection.

    PUBLIC lcDSNLess
    lcDSNLess = 'DRIVER={MySQL ODBC 5.3 ANSI Driver};UID=root;PWD=password;Database=db_name;Ser ver=server_name;DRIVER ={MySQL ODBC 5.3 ANSI Driver};PORT=3306;'
    gnConnHandle = SQLSTRINGCONNECT(lcDSNLess)

    So, I am at a loss as to why I can connect to the MySQL database from the ODBC Data Source Administrator but not from within VFP?

  4. #4
    Join Date
    Jul 2015
    Posts
    2
    I have the same problem. All work fine, but when I upgrade de Mysql ODBC no more work.
    How did you solve it?

  5. #5
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    Quote Originally Posted by tango742 View Post
    From VFP, the sqlstringconnect function returns a negative value using the "MySQL ODBC 5.3 ANSI Driver", therefore no connection.
    Unfortunately it takes several steps to debug this kind of problem. Convert the negative number to hexadecimal (eight characters), the leftmost digit ought to be an 8. This hexadecimal number is called an HRESULT, and can be searched (using Bing, Google, etc.) to determine why the connection failed.

    -PatP
    In theory, theory and practice are identical. In practice, theory and practice are unrelated.

  6. #6
    Join Date
    Jul 2015
    Posts
    2
    Sqlconnect returns -1 if the connection fails.
    I installed 32bits version of ODBC of mysql and it seems that it works now ("MySQL ODBC Unicode Driver 5.3" instead "MySQL ODBC ANSI Driver 5.3")

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •