note 94930 added to function.odbc-data-source
| From: | benjie at osu1 dot php dot net | Date: | Thu, 03 Dec 2009 07:47:54 +0000 |
| Subject: | note 94930 added to function.odbc-data-source | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-163519@lists.php.net to get a copy of this message | ||
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.
----
Server IP: 69.147.83.197
Probable Submitter: 222.127.136.122
----
Manual Page -- http://www.php.net/manual/en/function.odbc-data-source.php
Edit -- https://master.php.net/note/edit/94930
Del: integrated -- https://master.php.net/note/delete/94930/integrated
Del: useless -- https://master.php.net/note/delete/94930/useless
Del: bad code -- https://master.php.net/note/delete/94930/bad+code
Del: spam -- https://master.php.net/note/delete/94930/spam
Del: non-english -- https://master.php.net/note/delete/94930/non-english
Del: in docs -- https://master.php.net/note/delete/94930/in+docs
Del: other reasons-- https://master.php.net/note/delete/94930
Reject -- https://master.php.net/note/reject/94930
Search -- https://master.php.net/manage/user-notes.php