PHP PDO: SQLSTATE[08S01] SQLConnect: -829 [SAP][ODBC Driver][SQL Anywhere]TLS handshake failure

64 views Asked by At

Our database vendor recently changed to using TLS encryption (our Windows ODBC connections were previously unencrypted). The ODBC data sources are set up in Windows and are connecting without issue (as they did before, but now they're connecting correctly with the TLS encryption).

My impression is that PDO_ODBC uses the Windows data source to connect and isn't forming a connection independent of the data source. PHP PDO, however, is tossing the error:

SQLSTATE[08S01] SQLConnect: -829 [SAP][ODBC Driver][SQL Anywhere]TLS handshake failure

Even though the Windows data sources are all tested and working correctly.

This is the connection function:

function c_connect() {  

    global $pdo_conn;   
    
    ini_set('display_errors', 1);
    ini_set('display_startup_errors', 1);
    error_reporting(E_ALL);

    $dsn = "odbc:My_ODBC"; //changed for security
    $odbcusername = "user"; //changed for security
    $odbcpassword = "password"; //changed for security
    
    try {   
        //Connection String
        $pdo_conn = new PDO($dsn, $odbcusername, $odbcpassword);
                
        //Initiate Error Detection
        $pdo_conn->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION );   

    }
    
    catch(Exception $e)  {   
        echo "Invalid Connection: ";
        die( print_r( $e->getMessage() ) );  
    }
}

I've been searching all over and cannot find any information about what needs to be done here. It seems like the PDO connection may need to be adjusted to accommodate the TLS encryption change even though the ODBC connections are working without issue, but I'm not finding any specifics on what needs to be done.

0

There are 0 answers