Re: PHP + ODBC
| From: | Philip Thompson | Date: | Wed, 16 Dec 2009 15:07:18 +0000 |
| Subject: | Re: PHP + ODBC | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-300548@lists.php.net to get a copy of this message | ||
On Dec 15, 2009, at 9:50 AM, Richard Quadling wrote:
> 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);
I'm actually using a combination of the DSN*-string and the odbc.ini settings. Thank you!
~Philip