ADODB on FreeBSD

Recently I’ve had one of my student assistants working on setting up a web server. She’s pretty much got it, except that she hasn’t been able to establish a connection from the web server to our database server.

We’re wanting to use ADODB to connect to a mssql server. She figured out how to install the databases/adodb5 port (and how to get ADODB included in the PHP configuration), but that wasn’t enough by itself. I thought there might be a PHP extension required, and a little Unix pipe revealed the missing module:

# grep -i ^php /usr/ports/INDEX-7 | grep -v ^php4 | grep -i adodb

The command above searches the ports index for lines starting with “php” (or “PHP”), ignores those which begin with “php4” (I’m not interested in version 4 stuff), and searches everything that’s matched so far for “adodb” (or “ADODB”). Results:

php-adodb-ext... (long index line snipped)

A quick check of /var/db/pkg verified that this module hadn’t been installed yet. I installed the module via portmaster(8) and added the new extension per the pkg-message instructions:

# portmaster databases/php-adodb-ext
.
.
.
(installation stuff snipped)
# cat >>/usr/local/etc/php/extensions.ini
extension=adodb.so

Now we’re getting a different error:

PHP Fatal error:  Call to undefined function mssql_get_last_message() in /usr/local/share/adodb/drivers/adodb-mssql.inc.php on line 501

Google indicates the problem is likely that the mssql extension for PHP isn’t installed. I ran the same pipe that I did for ADODB, this time searching for mssql:

# grep -i ^php /usr/ports/INDEX-7 | grep -v ^php4 | grep -i adodb

php5-mssql... (long index line snipped)

So another portmaster(8) installation, this time for php5-mssql. One of php5-mssql’s dependencies is freetds-msdblib, which has some configuration options. The only one I’m setting is MSDBLIB, which enables MS SQLserver (in lieu of the old Sybase DB).

This port (php5-mssql) automatically registers itself as a PHP extension, so you don’t have to add a line to /usr/local/etc/php/extensions.ini yourself.

I’m still getting errors, but they’re starting to look like problems with the database connection string instead of server configuration now. Progress, of a sort. But that’s enough for now–It’s almost 8:00 pm on Friday night before a 3-day weekend, long past time for me to get on with my own life!

About Jim Vanderveen

I'm a bit of a Renaissance man, with far too many hobbies for my free time! But more important than any hobby is my family. My proudest accomplishment has been raising some great kids! And somehow convincing my wife to put up with me since 1988. ;)
This entry was posted in FreeBSD, Uncategorized and tagged , , , , , , . Bookmark the permalink.

3 Responses to ADODB on FreeBSD

  1. Jim says:

    I think the final problem might have to do with the [FreeTDS configuration](http://joseph.randomnetworks.com/archives/2005/06/16/sql-server-2000-notes/) on the server. I’ll have my student assistant check into that tomorrow morning.

  2. Jim says:

    I forgot to post our success! The FreeTDS configuration was indeed the problem. We were trying to specify the DNS name of our (MicroSoft) SQLServer, when we should have been using the “dataserver” name (whatever is specified in square brackets in the freetds.conf file).

  3. Jim says:

    Over the last few days I’ve had to rebuild FreeTDS. I discovered a few things that might be helpful in the future:

    – $ tsql -C (at the shell prompt) will show you the compile-time options used for tsql and FreeTDS. In particular, it will show the default “TDS version”, which seems to affect the debug/dump output.
    – # env TDS_VER=8.0 portmaster databases/freetds (at Charlie Root’s prompt) will build FreeTDS with SQL Server 2008 (?) support as the default. The dump file under this version is much more informative.

    Some other tidbits from [this post](http://lists.ibiblio.org/pipermail/freetds/2011q1/026809.html) on the freetds mailing list: James (maintainer) has been having some technical troubles from his hosting company (which knocked http://www.freetds.org off the Internet), as well as SourceFourge. He’s planning to bail out of SourceForge once the upcoming release is finished.

Leave a Reply to Jim Cancel reply

Your email address will not be published. Required fields are marked *