One feature of almost every modern commercial website is the location finder. Enter in a search address, and site displays the closest locations to it with the distances (as the crow flies).
I ran into a couple of peculiar bugs trying to calculate distances in SQL. Floating point math is never easy, and these are the issues I faced using our Microsoft SQL Server database.
At work, we use Microsoft SQL Server and IBM AS400 databases. Here’s
how I set our Linux boxes to allow them to connect to the databases
through ODBC. There are seperate instructions for the
Debian and Ubuntu (9.10 Karmic Koala) and Red Hat Enterprise Linux
(RHEL4 and RHEL5) distributions.
ODBC connections require several layers of software to work. The
bottom layer consists of the individual ODBC drivers for each
database system. Our top layer is the DBI/DBD interface for Perl.
In between these layers is the ODBC driver manager, which keeps
track of the DSN’s and their corresponding ODBC drivers.
Packages and Software to Install
Ubuntu Version (tested on 9.10 Karmic Koala)
Debian Version (“unstable” distribution)
We use unixODBC as our ODBC driver manager. First, install unixODBC:
NOTE: Perl’s DBD::ODBC module requires the developer’s version
of unixODBC, so install that one.