PHP PDO ODBC connection -
we trying create connection our sql database trough odbc in php.
this our current script:
$cnx = new pdo("odbc:driver={efr};server=localhost;port:7004;database=efr;uid=lclfvjfltktcehro;pwd=*********;");
the driver working in qlikview connects database.
the driver being found php, think can't login.
php returning following error:
fatal error: uncaught exception 'pdoexception' message 'sqlstate[im001] sqldriverconnect: 0 no transaction control system' in c:\program files (x86)\easyphp-12.1\www\index.php:2 stack trace: #0 c:\program files (x86)\easyphp-12.1\www\index.php(2): pdo->__construct('odbc:driver={ef...') #1 {main} thrown in c:\program files (x86)\easyphp-12.1\www\index.php on line 2
we hope can out problem.
if have odbc defined , have stored password, can connect with
$conn = new pdo("odbc:dsn_name")
where dsn_name actual name of odbc datasource, mysql, sql server or db2.
you can test connection following:
try{ $conn = new pdo ("odbc:dsn_name"); die(json_encode(array('outcome' => true))); } catch(pdoexception $ex){ die(json_encode(array('outcome' => false, 'message' => 'unable connect'))); }
Comments
Post a Comment