note 94930 deleted from function.odbc-data-source by thiago
| From: | thiago@php.net | Date: | Thu, 03 Dec 2009 11:57:31 +0000 |
| Subject: | note 94930 deleted from function.odbc-data-source by thiago | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-163526@lists.php.net to get a copy of this message | ||
Note Submitter: benjie
----
The description of odbc_data_source is misleading. It says "Returns information about a current
connection" but in actual fact, it returns all possible DSNs in your server (on subsequent
calls) ...and the first call doesn't even return the description of the current connection at
all example:
$dsn = "DRIVER={MySQL ODBC 5.1 Driver};Server=localhost;Database=mysql";
$conn = odbc_connect($dsn, 'root', '') or die(odbc_errormsg() );
$result = @odbc_data_source($conn, SQL_FETCH_FIRST) ;
var_dump($result);
odbc_close($conn);
outputs the following on my machine:
array(2) { ["server"]=> string(11) "dBASE Files"
["description"]=> string(51) "Microsoft Access dBASE Driver (*.dbf, *.ndx,
*.mdx)" }
Which is not one would expect (or am I wrong?). I would expect 'server' to return
'MySQL' since that is the DSN I used to connect.
Is there any way I can get the data source info of the current connection I am in?
Thanks.