Search code examples
phpmysqlsql-serverpdofreetds

mysql communicate with mssql on different server via php


I have mysql on a linux server which I own having CentOS installed in it. I want to fetch data from another windows server having mssql database.

I need to create a php script that can get the values from mssql server and insert it into mysql server.

I have tried installing FreeTDS also PDO but still I am unable to connect (not sure if I have installed it properly). The error messages I get are Could not Connect to the server and drivers not found.

How can I check if I have installed freetds and PDO drivers correctly.

Basic Diagram of what I am trying to do:

Server A (Mumbai) {Linux Cent OS, FreeTDS and PDO installed} ---------> Server B (Delhi) {Windows, MSSql}

I want to get data from Server B to Server A.

locale is "en_US.UTF-8"
locale charset is "UTF-8"
using default charset "UTF-8"
62Error 20009 (severity 9):
        Unable to connect: Adaptive Server is unavailable or does not exist
        OS error 110, "Connection timed out"
There was a problem connecting to the server

root@server [~]# tsql -C
Compile-time settings (established with the "configure" script)
                            Version: freetds v0.91
             freetds.conf directory: /usr/local/etc
     MS db-lib source compatibility: no
        Sybase binary compatibility: no
                      Thread safety: yes
                      iconv library: yes
                        TDS version: 5.0
                              iODBC: no
                           unixodbc: yes
              SSPI "trusted" logins: no
                           Kerberos: no

How can I update TDS version form 5 to 7

Please guide.


Solution

  • Configure FreeTDS

    This is a perfect tutorial for configuring FreeTDS. Every thing from basic..superb tutorial.

    Thanks to Hugo Brown.