Exception PDOException with message SQLSTATE[HY000] Name too long for LOGINREC field (severity 2)

Error: When connecting to MS SQL using freetds 0.91 and php>5.3:

Exception ‘PDOException’ with message ‘SQLSTATE[HY000] Name too long for LOGINREC field (severity 2)’

Cause:

Any string exceeds 30 characters in connection info like username, password, client host name will cause this error.

Solution:

Check client hostname in /etc/sysconfig/network, reduce it to less than 30 characters

Check username and password length in DB connection string, reduce it to less than 30 characters

Exception PDOException with message SQLSTATE[HY000] Name too long for LOGINREC field (severity 2)