Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid UTF-8 name in connection string produces wrong error message in Linux #432

Closed
david-puglielli opened this issue Jun 9, 2017 · 1 comment

Comments

@david-puglielli
Copy link
Contributor

See sqlsrv_connStr.phpt. When the server name is invalid in UTF-8, the connection attempt fails with an error message as follows:

Array
(
    [0] => Array
        (
            [0] => HYT00
            [SQLSTATE] => HYT00
            [1] => 0
            [code] => 0
            [2] => [unixODBC][Microsoft][ODBC Driver 13 for SQL Server]Login timeout expired
            [message] => [unixODBC][Microsoft][ODBC Driver 13 for SQL Server]Login timeout expired
        )

    [1] => Array
        (
            [0] => 08001
            [SQLSTATE] => 08001
            [1] => 11002
            [code] => 11002
            [2] => [unixODBC][Microsoft][ODBC Driver 13 for SQL Server]TCP Provider: Error code 0x2AFA
            [message] => [unixODBC][Microsoft][ODBC Driver 13 for SQL Server]TCP Provider: Error code 0x2AFA
        )

    [2] => Array
        (
            [0] => 08001
            [SQLSTATE] => 08001
            [1] => 11002
            [code] => 11002
            [2] => [unixODBC][Microsoft][ODBC Driver 13 for SQL Server]A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online.
            [message] => [unixODBC][Microsoft][ODBC Driver 13 for SQL Server]A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online.
        )

)

This implies that the error is network-related, when in fact it is because the server name is not valid. The expected error message should correctly indicate that An error occurred translating the connection string to UTF-16. This may be fixed by replacing ToUtf16() with ToUtf16Strict() in convert_string_from_default_encoding() in core_util.cpp, but this change causes other test failures so further investigation is required.

@david-puglielli
Copy link
Contributor Author

This has been fixed. Closing issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants