Wednesday, February 1, 2012

Set ODBTP Connection (Connect to MS SQL server from Linux Web Server)

You need to install ODBTP client service in MS SQL Server machine when you try to connect to a MS SQL Database from a Linux Web Server.

Error often showed on this is:

Warning: [ODBTPERR][0]Unable to connect to server (Connection refused)


Solution:
------------
Download the package from http://sourceforge.net/projects/odbtp/


Installing the ODBTP Service on Windows NT / 2000 / XP Pro
===========================================

1. Create a directory for ODBTP service executables, i.e.,
   "md C:\ODBTP".

2. Copy odbtpctl.exe, odbtpsrv.exe and odbtpsrv.ini into directory.
   These files are stored in /winservice.

3. Open a command prompt window, change to the directory where you
   put the service executables, and then run the following commands:

        odbtpctl install
        odbtpctl start

Note: Once installed, the service can be stopped / started via
the Windows Service Control Manager.

Make sure that the service is set to start 'Automatic'

Do below things on the Linux Box
=======================

Installation of ODBTP PHP Extension
--------------------------------------

Static Version:

1. Make a directory called "odbtp" under the /ext
   directory.

2. Copy all files from /php/ext/odbtp to
   /ext/odbtp.

3. "cd" to and run ./buildconf.

4. Run ./configure and include the --with-odbtp option along
   with any other desired configure options.

5. Make and install PHP.


Shared Version:

1. Change to the directory /php/ext.

2. Open the file Makefile with a plain text editor, such as vi, and
   change the value of PHP_INCROOT, if necessary.

3. Run "make".

4. Copy the file php_odbtp.so to a location where it can be loaded in
   a PHP script with the dl() function.


Example PHP scripts that can be used for testing are contained in
/php/examples. The file odbtptest.sql can be used
to build the table and stored procedures used by the init.php,
list.php and rollback.php scripts.


***************************************************

No comments: