PHP can't connect to Teradata database SQLSTATE[HY000] SQLConnect: 15 or SQLSTATE[HY000] SQLDriverCo

Connectivity
Visitor

PHP can't connect to Teradata database SQLSTATE[HY000] SQLConnect: 15 or SQLSTATE[HY000] SQLDriverCo

I'am trying connect to Teradata database using PHP PDO ODBC from Windows 10. While PHP script executing, errors are displayed

SQLSTATE[HY000] SQLConnect: 15

or

SQLSTATE[HY000] SQLDriverConnect: 0 

PHP script is simple

try {

$connection = new PDO("odbc:Provider=Teradata;DBCName=Tera;Database=DBC;Uid=dbc;Pwd=dbc;");
/* also tried */
// $connection = new PDO("odbc:Driver={Teradata Database ODBC Driver 16.10};Server=192.168.1.40;Database=DBC;User=dbc;Password=dbc;");

} catch (PDOException $e) {

die('Failed to connect '. $e->getMessage());
}

 

So, earlier to test a work between Teradata and PHP, I'am downloaded Teradata Express WMware image and installed it using WMware player, also receive IP of a virtual machine. Then installed Teradata Tools and Utilities (full package) with ODBC driver. I'am tested connection to Teradata database from Windows 10 with Teradata SQL assistant and it successfully connected to dbc database with dbc/dbc credentials.

 

System DSN is configured properly

teradata-1.png

 

teradata-2.png
Why PHP can't connect to Teradata through PDO ODBC Driver?

1 REPLY
Teradata Employee

Re: PHP can't connect to Teradata database SQLSTATE[HY000] SQLConnect: 15 or SQLSTATE[HY000] SQLDriv

Neither of those connection strings is valid, though for different reasons. Try one of the following:

 

$connection = new PDO("odbc:DSN=Tera;Database=DBC;Uid=dbc;Pwd=dbc;");
/* or */
// $connection = new PDO("odbc:Driver={Teradata Database ODBC Driver 16.10};DBCName=192.168.1.40;Database=DBC;UserName=dbc;Password=dbc;");