Results 1 to 3 of 3

Thread: Warning: mssql_connect() [function.mssql-connect]: Unable to connect to ser

  1. #1
    Registered User
    Join Date
    Jul 2012
    Posts
    2
    cPanel/WHM Access Level

    DataCenter Provider

    Default Warning: mssql_connect() [function.mssql-connect]: Unable to connect to ser

    Hi, I've installed and configured freetds with odbc and added -with-mssql, linked the lib64 dir and confirmed the config with

    root@test [/usr/local/cpanel/scripts]# php -i | grep mssql
    mssql
    mssql.allow_persistent => On => On
    mssql.batchsize => 0 => 0
    mssql.charset => no value => no value
    mssql.compatability_mode => Off => Off
    mssql.connect_timeout => 5 => 5
    mssql.datetimeconvert => On => On
    mssql.max_links => Unlimited => Unlimited
    mssql.max_persistent => Unlimited => Unlimited
    mssql.max_procs => Unlimited => Unlimited
    mssql.min_error_severity => 10 => 10
    mssql.min_message_severity => 10 => 10
    mssql.secure_connection => Off => Off
    mssql.textlimit => Server default => Server default
    mssql.textsize => Server default => Server default
    mssql.timeout => 60 => 60

    it also shows correct in a info.php file.

    I've checked the db connections with the php connection file and they are all correct but when trying to load the page that's calling info from the SQL db I get connection errors:

    Warning: mssql_connect() [function.mssql-connect]: Unable to connect to server: x.x.x.x in /home/keyzotes/public_html/Connections/adodb5/drivers/adodb-mssql.inc.php on line 614

    it shows this error for all the data fed content, just the line numbers vary.

    I can telnet to the db on 1433 no problem, I can also connect successfully using tdserver=7.0 tsql -H x.x.x.x -p 1433 -U sa

    I'm out of ideas, can anyone help suggest anything to check?

    Thanks - Simon

  2. #2
    Registered User
    Join Date
    Jul 2012
    Posts
    2
    cPanel/WHM Access Level

    DataCenter Provider

    Default Re: Warning: mssql_connect() [function.mssql-connect]: Unable to connect to

    Quote Originally Posted by simon@saq.co.uk View Post
    Hi, I've installed and configured freetds with odbc and added -with-mssql, linked the lib64 dir and confirmed the config with

    root@test [/usr/local/cpanel/scripts]# php -i | grep mssql
    mssql
    mssql.allow_persistent => On => On
    mssql.batchsize => 0 => 0
    mssql.charset => no value => no value
    mssql.compatability_mode => Off => Off
    mssql.connect_timeout => 5 => 5
    mssql.datetimeconvert => On => On
    mssql.max_links => Unlimited => Unlimited
    mssql.max_persistent => Unlimited => Unlimited
    mssql.max_procs => Unlimited => Unlimited
    mssql.min_error_severity => 10 => 10
    mssql.min_message_severity => 10 => 10
    mssql.secure_connection => Off => Off
    mssql.textlimit => Server default => Server default
    mssql.textsize => Server default => Server default
    mssql.timeout => 60 => 60

    it also shows correct in a info.php file.

    I've checked the db connections with the php connection file and they are all correct but when trying to load the page that's calling info from the SQL db I get connection errors:

    Warning: mssql_connect() [function.mssql-connect]: Unable to connect to server: x.x.x.x in /home/keyzotes/public_html/Connections/adodb5/drivers/adodb-mssql.inc.php on line 614

    it shows this error for all the data fed content, just the line numbers vary.

    I can telnet to the db on 1433 no problem, I can also connect successfully using tdserver=7.0 tsql -H x.x.x.x -p 1433 -U sa

    I'm out of ideas, can anyone help suggest anything to check?

    Thanks - Simon

    I noticed that freetds.log was showing an attempted connection to port 4000. I have added the port to the connection details in the php file "x.x.x.x:1433" and now the connection is attempted as the following log shows but it drops it during the negotiation process. I'm also (I thought!) using version 0.64 (7) but this is reading version 5, I don't know where freetds is retriving the incorrect details becase I have specified them in /usr/local/etc/freetds.conf

    Code:
    root@test [/usr/local/etc]# cat  /tmp/freetds.log
    log.c:196:Starting log file for FreeTDS 0.91
            on 2012-07-16 16:33:45 with debug flags 0x4fff.
    iconv.c:330:tds_iconv_open(0x108ccc70, ISO-8859-1)
    iconv.c:187:local name for ISO-8859-1 is ISO-8859-1
    iconv.c:187:local name for UTF-8 is UTF-8
    iconv.c:187:local name for UCS-2LE is UCS-2LE
    iconv.c:187:local name for UCS-2BE is UCS-2BE
    iconv.c:349:setting up conversions for client charset "ISO-8859-1"
    iconv.c:351:preparing iconv for "ISO-8859-1" <-> "UCS-2LE" conversion
    iconv.c:391:preparing iconv for "ISO-8859-1" <-> "ISO-8859-1" conversion
    iconv.c:394:tds_iconv_open: done
    net.c:205:Connecting to x.x.x.x port 1433 (TDS version 5.0)
    net.c:270:tds_open_socket: connect(2) returned "Operation now in progress"nnet.c:310:tds_open_socket() succeeded
    util.c:156:Changed query state from DEAD to IDLE
    net.c:741:Sending packet
    0000 02 00 02 00 00 00 00 00-74 65 73 74 2e 73 61 71 |........ test.saq|
    0010 2e 6e 65 74 00 00 00 00-00 00 00 00 00 00 00 00 |.net.... ........|
    0020 00 00 00 00 00 00 0c 73-61 00 00 00 00 00 00 00 |.......User.......|
    0030 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |........ ........|
    0040 00 00 00 00 00 02 4a 65-64 69 39 39 39 00 00 00 |......PassWord...|
    0050 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |........ ........|
    0060 00 00 00 00 07 34 39 32-31 00 00 00 00 00 00 00 |.....492 1.......|
    0070 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |........ ........|
    0080 00 00 00 04 03 01 06 0a-09 01 00 00 00 00 00 00 |........ ........|
    0090 00 00 00 00 50 48 50 20-35 00 00 00 00 00 00 00 |....PHP  5.......|
    00a0 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |........ ........|
    00b0 00 00 05 39 33 2e 31 37-34 2e 31 33 38 2e 32 31 |...x.x.x.x|
    00c0 30 3a 31 34 33 33 00 00-00 00 00 00 00 00 00 00 |0:1433.. ........|
    00d0 00 13 00 07 4a 65 64 69-39 39 39 00 00 00 00 00 |....PassWord.....|
    00e0 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |........ ........|
    00f0 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |........ ........|
    0100 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |........ ........|
    0110 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |........ ........|
    0120 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |........ ........|
    0130 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |........ ........|
    0140 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |........ ........|
    0150 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |........ ........|
    0160 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |........ ........|
    0170 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |........ ........|
    0180 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |........ ........|
    0190 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |........ ........|
    01a0 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |........ ........|
    01b0 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |........ ........|
    01c0 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |........ ........|
    01d0 00 09 05 00 00 00 44 42-2d 4c 69 62 72 61 72 79 |......DB -Library|
    01e0 0a 05 00 00 00 00 0d 11-75 73 5f 65 6e 67 6c 69 |........ us_engli|
    01f0 73 68 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |sh...... ........|
    
    net.c:741:Sending packet
    0000 02 01 00 61 00 00 00 00-00 00 00 00 00 00 0a 00 |...a.... ........|
    0010 00 00 00 00 00 00 00 00-00 00 00 00 00 69 73 6f |........ .....iso|
    0020 5f 31 00 00 00 00 00 00-00 00 00 00 00 00 00 00 |_1...... ........|
    0030 00 00 00 00 00 00 00 00-00 00 00 05 01 35 31 32 |........ .....512|
    0040 00 00 00 03 00 00 00 00-e2 16 00 01 09 00 08 0e |........ ........|
    0050 6d 7f ff ff ff fe 02 09-00 00 00 00 02 68 00 00 |m....... .....h..|
    0060 00                     -                        |.|
    
    token.c:328:tds_process_login_tokens()uutil.c:331:tdserror(0xfa33540, 0x108ccc70, 20017, 115)
    dblib.c:7929:dbperror(0x108cc110, 20017, 115)
    dblib.c:7981:20017: "Unexpected EOF from the server"
    dblib.c:8002:"Unexpected EOF from the server", client returns 2 (INT_CANCEL)
    util.c:361:tdserror: client library returned TDS_INT_CANCEL(2)
    util.c:384:tdserror: returning TDS_INT_CANCEL(2)
    util.c:156:Changed query state from IDLE to DEAD
    token.c:337:looking for login token, got  0()
    token.c:122:tds_process_default_tokens() marker is 0()
    token.c:125:leaving tds_process_default_tokens() connection dead
    login.c:466:login packet accepted
    util.c:331:tdserror(0xfa33540, 0x108ccc70, 20002, 0)
    dblib.c:7929:dbperror(0x108cc110, 20002, 0)
    dblib.c:7981:20002: "Adaptive Server connection failed"
    dblib.c:8002:"Adaptive Server connection failed", client returns 2 (INT_CANCEL)
    util.c:361:tdserror: client library returned TDS_INT_CANCEL(2)
    util.c:384:tdserror: returning TDS_INT_CANCEL(2)
    dblib.c:1443:dbclose(0x108cc110)
    dblib.c:258:dblib_del_connection(0x2b13d9403620, 0x108ccc70)
    mem.c:615:tds_free_all_results()
    dblib.c:305:dblib_release_tds_ctx(1)
    dblib.c:5882:dbfreebuf(0x108cc110)
    dblib.c:739:dbloginfree(0x1088bb10)
    dblib.c:3999:dbsettime(60)
    dblib.c:3999:dbsettime(60)
    dblib.c:1512:dbexit(void)
    dblib.c:305:dblib_release_tds_ctx(1)
    
    root@test [/usr/local/etc]# tsql -C
    Compile-time settings (established with the "configure" script):
                               Version: freetds v0.64
        MS db-lib source compatibility: no
           Sybase binary compatibility: unknown
                         Thread safety: yes
                         iconv library: yes
                           TDS version: 7.0
                                 iODBC: no
                              unixodbc: yes

  3. #3
    Registered User
    Join Date
    Sep 2012
    Posts
    1
    cPanel/WHM Access Level

    Website Owner

    Default Re: Warning: mssql_connect() [function.mssql-connect]: Unable to connect to

    Just wondering if you figured this out. I have been pulling my hair out over it myself.

    If you have access to the tsql program then I might suggest running the following command:

    tsql -LH xxx.xxx.xxx.xxx

    Where xxx.xxx.xxx.xxx is the IP address of the supposed SQL server. It should return you information with the server name, instance, if its a cluster, the version and "the port". I could have sworn that SQL Server would be listening to 1433, and perhaps it is for certain protocols. However, this nice little program informed me I was completely wrong.

    The FreeTDS doc is pretty good too: /http://freetds.schemamania.org/userguide/confirminstall.htm#TSQL

Similar Threads

  1. cPanel ChkServd httpd failed - Unable to connect to connect to 80
    By asiansexynine in forum General Discussion
    Replies: 5
    Last Post: 12-25-2011, 09:14 AM
  2. i want to connect mssql server
    By wdp in forum General Discussion
    Replies: 2
    Last Post: 05-09-2008, 09:37 PM
  3. Replies: 0
    Last Post: 09-14-2007, 10:43 PM
  4. Warning: fsockopen(): unable to connect to localhost:25
    By mahdionline in forum General Discussion
    Replies: 7
    Last Post: 08-03-2006, 11:14 AM
  5. Warning: fsockopen(): unable to connect to
    By itrends in forum General Discussion
    Replies: 12
    Last Post: 06-17-2005, 01:51 AM
bargain