Reputation: 1837
According to the documentation for SQLDriverConnect,
Because of connection string and initialization file grammar, keywords and attribute values that contain the characters []{}(),;?*=!@ not enclosed with braces should be avoided.
and
A DSN or connection string value enclosed with braces ({}) containing any of the characters []{}(),;?*=!@ is passed intact to the driver.
Using the connection string DSN=%s;UID=%s;PWD={%s}
works in SQLServer - infact if there are certain special characters then not enclosing the password in {} fails. However, using the same string for MS Access fails with "invalid password" and works when {}
is removed. It also does not work with Oracle.
If the string enclosed in the {} is passed intact to the server, then shouldn't it work? Or am I missing something?
Upvotes: 4
Views: 818
Reputation: 253
SQLDriverConnect's Access-specific page states that:
The PWD keyword should not include any of the special characters (see SQL_SPECIAL_CHARACTERS in SQLGetInfo Returned Values).
Calling the SQLGetInfo function while connected to Access and passing SQL_SPECIAL_CHARACTERS as the InfoType argument should return the forbidden characters @Andrew Gibson mentioned.
The "More Information" section of a knowledge base article has a list of special characters not recommended for use in an Access app.
IBM's DB2 has an identically named SQLGetInfo function with an identical parameter list and takes the same InfoType constant to return special characters, listed there as:
all characters except a...z, A...Z, 0...9, and underscore
Upvotes: 1