Link to home
Start Free TrialLog in
Avatar of formadmirer
formadmirerFlag for United States of America

asked on

VFP MySQL String Connect Issue

Hi all.

I am using VFP 9 connecting to MySQL with the MySQL ODBC driver v3.51 and am having the following issue.

If a password to a database contains non-alphanumeric characters, for example a ';' or '[' the connection will fail. If I change the password to the db to just characters and numbers the connection succeeds.

Other programs that connect to the database can use the original password containing the special characters, so I know the issue lies within the VFP/ODBC connection.

I was just wondering if anyone else has experienced this and if there is a known workaround.
SOLUTION
Avatar of Dave Baldwin
Dave Baldwin
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I wonder if this is just stated for MSSQL Server, but ; also is a seperator in connection strings to denote the end of one config section as in "server=localhost;db=test;..."

What you can try is putting a password with such chars in quotes:
lcConn="...;PWD='passwordwith;';..."

Bye, Olaf.
The problem is with the ODBC interface, not the driver.  You can look here http://www.connectionstrings.com/ and see that all of the ODBC connection strings use punctuation as delimiters in the connection strings.
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I'm glad you tested that.  I have never seen an example where quotes were used before.
Avatar of formadmirer

ASKER

It seems to be very finicky, very hit and miss about what it will accept and not accept.
I created an account and tried these passwords, both with and without single quotes.

)ue.?h%5J?9Z
TW[?+*)@ZL3R

[]{}(),;?*!@123

The top two passwords were accepted both with and without quotes, even though they contain illegal characters.

The third password, Olaf's example, I could not get to work no matter what I did.

I think I'll just scan the passwords chosen for illegal chars and suggest they choose another.

thanks for all the help!
Just notice, I checked this with an SQL Server. In regard to the article mentioned this should not work, especially with SQL Server. And in regard to David not with any ODBC driver.

The MySQL docs also don't mention allowed or disallowed chars, but you find somthing in the bugtracking list: http://bugs.mysql.com/bug.php?id=52404

As you say other applications or clients can login the error has to be either the old ODBC version (we have ODBC 5.1.11) or it's even chars you can't write into an ANSI Codepage 1252 encode foxpro prg. If it's the latter, there are ways to convert eg unicode chars to their hex representation and generate the unicode string in FoxPro programmatically, instead of using a string literal for the connection string.

Bye, Olaf.