[Cialug] odbc_connect

Adam Hill adam at diginc.us
Wed Apr 26 17:44:43 CDT 2017


Have you tried this type of DNS-less connection documented here ?
http://php.net/manual/en/function.odbc-connect.php

Example #1 DSN-less connections
<?php
// Microsoft SQL Server using the SQL Native Client 10.0 ODBC Driver -
allows connection to SQL 7, 2000, 2005 and 2008
$connection = odbc_connect("Driver={SQL Server Native Client 10.0};Server=
$server;Database=$database;", $user, $password);
Some of the comments on that page maybe valuable too, this one sounds
similar: http://php.net/manual/en/function.odbc-connect.php#51420 -
basically confirm that your php.ini / php.d files load all the necessary
odbc configuration for it'd php module.  Speaking of which, have you peaked
into your php_info() to see if that shares any insights into the odbc php
module?

On Wed, Apr 26, 2017 at 5:08 PM L. V. Lammert <lvl at omnitec.net> wrote:

> On Wed, 26 Apr 2017, Adam Hill wrote:
>
> > What does odbc_connect do?  error out?
> >
> Yep;
>
> $ php testVAM_odbc.php
> PHP Warning:  odbc_connect(): SQL error: [unixODBC][Driver Manager]Data
> source name not found, and no default driver specified, SQL state IM002 in
> SQLConnect in /home/lvl/test/testVAM_odbc.php on line 9
> FAIL!
>
> > Have you tried this function to list data sources
> > http://php.net/manual/en/function.odbc-data-source.php ?  which I
> believe
> > should match your odbc.ini if it were reading from there.
> >
> Unfortunately, need odbc_connect to get a connect_id, so can't run that.
>
>         Lee
> _______________________________________________
> Cialug mailing list
> Cialug at cialug.org
> http://cialug.org/mailman/listinfo/cialug
>


More information about the Cialug mailing list