On 3/20/07, Joaquin Herrero <[EMAIL PROTECTED]> wrote:
 Hi,

Has anyone succeded in using iodbc or unixodbc to access a remote database
ODBC-compliant?
I need to use some data from a SQL Server for the application I'm
developping (PHP+MySQL on OpenBSD) but I don't  find any information about
how to proceed.

I can install the iodbc package on a OpenBSD 4.0 machine, but then, what
should I do to access a remote SQLServer database?
Do I need some extra driver?

If someone has experience on this, please tell me, cause I'm stuck with this
problem.



I regularly connect PHP to MSSQL server with a different technique:
FreeTDS in the ports tree. It's quite simple.

Here's how:

1.) To use w/SQL2000 add --with-tdsver=8.0 to your FreeTDS Makefile
CONFIGURE-ARGS (/usr/ports/databases/freetds/Makefile). This makes
FreeTDS play nicely with SQL2000. Apparently without this long strings
get buggered when connecting to SQL2000.

Ours looks like this:
CONFIGURE_ARGS= ${CONFIGURE_SHARED} \
               --enable-static \
               --with-libiconv-prefix="${LOCALBASE}" \
               --disable-threadsafe \
               --disable-odbc \
               --with-tdsver=8.0

(Remember to run 'make install' to actually *install* your
SQL2000-friendly FreeTDS.)

2.) To your PHP5 Makefile.inc CONFIGURE-ARGS
(/usr/ports/www/php5/Makefile.inc) add --with-mssql=/usr/local to make
you PHP installation SQL-aware.

Ours looks like this:
CONFIGURE_ARGS+=        --enable-shared \
                       --disable-static \
                       --disable-rpath \
                       --with-config-file-path=${PHP_CONFIG_PATH} \
                       --enable-inline-optimization \
                       --with-pic \
                       --with-mssql=/usr/local

(Remember to run the appropriate 'make XXXXX' and pkg_add for your
particular environment to actually build and install your
MSSQL-friendly PHP5.)

You'll find the global variables for freetds are in /etc/freetds.conf.
These normally require next to no setup for your particular
environment.


With that... presto! Instant PHP5-MSSQL connectivity. You can confirm
this worked with a simple:  <? phpinfo(); ?>

Now for the requisite qualifiers:

1.) This is an unsupported configuration. If it breaks, you are on your own. :-)
2.) There are probably easier, supported ways to do this.
3.) I've been using this technique for *years*. It has been fast,
stable, and reliable for everything I've needed it for. YMMV.

Last thing... remember to:
-- _actually follow_ the post pkg_add instructions.
-- verify that you've _really_ enabled PHP in your httpd.conf and php.ini

Good luck,
Al




--
http://www.memetrics.com -
Multivariate testing with Memetrics xOs.
Landing page optimization, design & consulting.

Reply via email to