#1
  1. Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Nov 2003
    Posts
    694
    Rep Power
    95

    Connect to remote server


    I am trying to connect to a remote MS SQL 2008 server with:
    PHP Code:
    $link mysql_connect('10.1.1.16:1433''ID''password'); 
    if (!
    $link
          die(
    'Could not connect: ' mysql_error()); 
    and I receive the message
    Could not connect: MySQL server has gone away
    The php error log shows:
    PHP Code:
    [10-Oct-2012 20:02:47PHP Warning:  mysql_connect(): Error while reading greeting packetPID=61066 in /home/epanagio/play/remote_connect.php on line 2 [10-Oct-2012 20:02:47PHP Warning:  mysql_connect(): MySQL server has gone away in /home/epanagio/play/remote_connect.php on line 2 
    I also tried port 3306 but that produced a
    Could not connect: Connection refused
    What am I missing here?
    Evan
  2. #2
  3. No Profile Picture
    Stumpier old Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jun 2003
    Posts
    14,409
    Rep Power
    4538
    You're trying to use the drivers for mysql to connect to a mssql server. That won't work. You need to use the mssql drivers.
    ======
    Doug G
    ======
    It is a truism of American politics that no man who can win an election deserves to. --Trevanian, from the novel Shibumi
  4. #3
  5. Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Nov 2003
    Posts
    694
    Rep Power
    95
    Stupid!
    I changed it to:
    PHP Code:
    $link mssql_connect('10.1.1.16:1433''ID''password'); 
    and I receive a
    PHP Code:
    PHP Warning:  mssql_connect(): Unable to connect to server10.1.1.16:1433 in /home/epanagio/play/remote_connect.php on line 2 
    in the php error log. I have installed something called freetds that makes the connection "easier." In the /usr/ports/databases/freetds/work/freetds-0.64/freetds.conf I have specified:
    # A typical Microsoft SQL Server 2000 configuration [MyServer2k] host = 10.1.1.16 port = 1433 tds version = 8.0
    [MyServer2k]
    host = 10.1.1.16
    port = 1433
    tds version = 8.0
    but it doesn't connect.
    Last edited by epanagio; October 10th, 2012 at 08:45 PM.
    Evan

IMN logo majestic logo threadwatch logo seochat tools logo