Is there a way to tell the differences of a PostgreSQL, MySQL or MSSQL connection resource?

129 Views Asked by At

If I have $dbConn (a database connection) and I don't know if it's MySQL, MSSQL or PostgreSQL can I tell what type of connection it is?

Just wanted to know if there is a method to return the connection type of a resource id?

EDIT: Sorry, yes PHP added the tag

1

There are 1 best solutions below

0
On BEST ANSWER
$connection = mysql_connect(...); 

$is_mysql = (get_resource_type($connection) == 'mysql link');
$is_ibase = (get_resource_type($connection) == 'Firebird/InterBase link'); // *

var_dump($is_mysql); // -> true

// * supposed to be "interbase link" but isn't any longer