#native_company# #native_desc#
#native_cta#

Microsoft SQL Server from PHP on Linux Page 5

By Alberto Dainotti
on September 19, 2000

ODBC drivers for linux which connect to MS SQL:

Openlink Universal Data Access Drivers Multi-Tier Edition
This is a commericial bridged solution; the software is split in pieces.
On the client side (php+linux), you need to have installed php with openlink’s
driver manager (l3kozzzz.taz) and the odbc driver (l3brzzzz.taz).
On the server machine (the one with ms sql) you must install a “request broker”
and a “database agent”. The request broker will accept tcp connections and will
forward the requests to the database agent which will query directly into the
SQLServer database without going through the native SQLServer driver. This will
speed things up a little. However, an ODBC bridged solutions is constituted of
more layers of communication.
There is also the disadvantage in installing and configuring part of the
software on the Windows machine, which is not always desiderable.
Finally the most important thing is that this is a commercial solution!
The binaries are downloadable with a free, not expiring license, but with a
limit of 10 concurrent connections and two different concurrent client hosts.
Easysoft ODBC-ODBC Bridge 2000
This is another commercial bridged solution. The features are somewhat similar
to that of Openlink. It is suggested to use this driver with unixODBC
as driver manager. The software can be downloaded for free, with a not expiring license,
with a limit of only 1 connection !
Inline TDS ODBC driver
Inline TDS ODBC driver is developed by Inline Internet Systems (www.inline.net)
and can be downloaded from http://library.freeodbc.org download page.
This odbc driver is different from the others because it communicates directly
with the dbms engine, and is not a bridge of any sort.
This is a faster and lighter solution compared to the other two, and it is totally free.
The driver is currently released only in binary form, but Inline has the
intention to release the source too. The freetds library will be updated then.
I’ve tested the driver with unixODBC and it works perfectly, it even lets you
choose what tds version to use in the DSN file.
Installation instructions are covered in a text distributed with the driver.

An alternative partially-ODBC solution:

Finally, I should mention another software which will make you able to access a remote MS SQL
server from php: ODBC Socket Server by Team FXML downloadable from http://odbc.linuxave.net.
This solution is not totally odbc because it doesn’t require installation of any odbc driver or driver
manager on the machine running php.
ODBC Socket Server is constituted of server-side software installed under Windows NT (or Win98,
but it is not considered the optimal operating environment) and client-side software
for COM, C++, Perl, Python and PHP.
The server-side software is a Windows NT service which uses an XML protocol to transfer data from the Windows
NT ODBC Socket Service to TCP/IP clients. It opens a tcp/ip socket and listens for incoming connections
on a specific port. The queries and the results will be exchanged using the XML protocol.
The client-side software in the case of PHP is a very small php class to connect to the socket server,
which basically defines a function ExecSQL() to establish a connection, send an SQL query and get the
result. However, you will need to parse the output result, which is XML encoded. To parse the output result, you could
use the PHP XML Parser module included in the latest versions of PHP.
ODBC Socket Server is an open source project licensed under the GPL. The software is well documented
and the installation very easy, including example code.

The End…

Several solutions have been introduced. The ones implementing the tds protocol have
been shown in more detail. In fact, these solutions are faster and easier to set up. Also, all
ODBC solutions are considered well documented, once you know the simple things explained here.
ODBC offers some advantages as code portability, but it shouldn’t be the first choice for
someone who has to solve this problem rapidly and has no experience of odbc (especially
under unix).
–Alberto

1
|
2
|
3
|
4
|
5