Re: PHP + ODBC
| From: | Richard Quadling | Date: | Tue, 15 Dec 2009 15:50:34 +0000 |
| Subject: | Re: PHP + ODBC | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-300530@lists.php.net to get a copy of this message | ||
2009/12/15 Philip Thompson <philthathril@gmail.com>:
> On Dec 14, 2009, at 8:47 PM, James McLean wrote:
>
>> On Tue, Dec 15, 2009 at 10:03 AM, Philip Thompson
>> <philthathril@gmail.com> wrote:
>>> My head hurts from hitting it on my desk all day, so I thought I'd turn to a
>>> fresher set of eyes. The issue I'm having is getting PHP to connect ODBC. I can get it to work
>>> using isql from the command line. Can you verify my settings....:
>>>
>> [snipped]
>>>
>>> I've tried the above DSNs and many other versions of it ad nauseum. The specific
>>> error I'm getting is... "[unixODBC][Driver Manager]Data source name not found, and no
>>> default driver specified." I really have searched high and low for a solution, but to no avail.
>>> Any thoughts?
>>
>> Why not just use the built in MySQL libraries or PDO?
>
> Oh, that would be "my" preference. However, the database that I really need to
> connect to is an MSSQL one and the allowed connection type is ODBC. I was just testing first with a
> MySQL connection to get it working (I don't have the MSSQL credentials yet). Turned out I was
> VERY close with my solution, which a coworker figured out this morning. The [ODBC Data Sources]
> entry for MySQL needed to specified correctly in /etc/odbc.ini.
>
> [ODBC Data Sources]
> MySQL = MySQL
>
> [MySQL]
> Description...
> Driver...
>
> I could have sworn I tried that, but who knows....
>
> Thank you!
> ~Philip
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
You can use a DNS-string too ...
odbc_pconnect("Driver={SQL Server Native Client
10.0};Server={$s_Server};Database={$s_DB};MARS_Connection=Yes;",
$s_User, $s_Pswd, SQL_CUR_USE_DRIVER);
--
-----
Richard Quadling
"Standing on the shoulders of some very clever giants!"
EE : http://www.experts-exchange.com/M_248814.html
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling