Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 15 of 20
  1. #1
    Member
    Join Date
    Sep 2011
    Posts
    12
    cPanel/Enkompass Access Level

    Root Administrator

    Exclamation ODBC connection error for fetching value from MSsql to MYsql

    here is my problem,


    website hosted on cPanel, owner of site requires information from a remote MS access database which user has username/password and hostname/ip address for.



    I assume I have to install some modules into EasyApache, and therefore enable some access for remote services yes/no ?

    i have mysql db on centos cpanel,
    and want to fetch database values from other server which has MSsql DB.

    now, dont know what to enable in whm and what to do on other (MSsql ) server

    my server's IP is whitelisted on other server, but still its not working.



    Any and all suggestion would be gratefuly received.

  2. #2
    cPanel Staff cPanelTristan's Avatar
    Join Date
    Oct 2010
    Location
    somewhere over the rainbow
    Posts
    6,305
    cPanel/Enkompass Access Level

    Root Administrator

    Default Re: ODBC connection error for fetching value from MSsql to MYsql

    For MSSQL to be available on Linux to fetch values, you'd have to install FreeTDS on the Linux machine:

    http://forums.cpanel.net/f5/definiti...ons-88561.html
    cPResources: Support Options | More Support Options | Forums Search | cPanel.net Site Search | Mailing Lists(Alt) | Docs
    -- Tristan, Forums Technical Analyst, cPanel Tech Support

    Submit a ticket | Check an existing ticket

  3. #3
    Member
    Join Date
    Sep 2011
    Posts
    12
    cPanel/Enkompass Access Level

    Root Administrator

    Default Re: ODBC connection error for fetching value from MSsql to MYsql

    i have tried that procedure , but still receiving same error
    here is the error
    Code:

    Warning: odbc_connect() [function.odbc-connect]: SQL error: [unixODBC][Driver Manager]Data source name not found, and no default driver specified, SQL state IM002 in SQLConnect in /home/frendzho/public_html/xyz.co.cc/mssql.php on line 5

    Warning: odbc_exec() expects parameter 1 to be resource, boolean given in /home/frendzho/public_html/xyz.co.cc/mssql.php on line 10
    Error in SQL

    its working fine on my local machine,and my server IP is already whitelisted by remote server.

  4. #4
    Member
    Join Date
    Sep 2011
    Posts
    12
    cPanel/Enkompass Access Level

    Root Administrator

    Default Re: ODBC connection error for fetching value from MSsql to MYsql

    can anyone help me about it??
    Last edited by dhruvpandit; 02-09-2012 at 12:05 AM.

  5. #5
    cPanel Staff cPanelTristan's Avatar
    Join Date
    Oct 2010
    Location
    somewhere over the rainbow
    Posts
    6,305
    cPanel/Enkompass Access Level

    Root Administrator

    Default Re: ODBC connection error for fetching value from MSsql to MYsql

    Here's another forum where this is discussed:

    How I Connect Ms-access Db With Php Using Odbc? - W3Schools Forum

    I will admit that I know nearly nothing about MSSQL, because it's a Windows-based SQL system. You might want to try asking in the Windows area if they know what you need to do for this type of error. Even though it's a PHP script, there is PHP scripting that occurs over in our Windows area and you might have more people familiar with MSSQL over there.

    The error itself isn't specifically indicating the driver doesn't work, just that you haven't actually selected the right driver.
    cPResources: Support Options | More Support Options | Forums Search | cPanel.net Site Search | Mailing Lists(Alt) | Docs
    -- Tristan, Forums Technical Analyst, cPanel Tech Support

    Submit a ticket | Check an existing ticket

  6. #6
    Member
    Join Date
    Sep 2011
    Posts
    12
    cPanel/Enkompass Access Level

    Root Administrator

    Default Re: ODBC connection error for fetching value from MSsql to MYsql

    i am usign this for local

    $dsn = "Driver={SQL Server};Server=xxx.xxx.xxx.xxx;Database=Partners;";
    $user = 'lskdg';
    $pass = 'fsalkdjg';
    $conn = odbc_connect($dsn, $user, $pass);
    if($conn){
    echo "I got it!.";
    }


    i think there is something wrong in first line i.e. "Driver={SQL Server};

  7. #7
    cPanel Staff cPanelTristan's Avatar
    Join Date
    Oct 2010
    Location
    somewhere over the rainbow
    Posts
    6,305
    cPanel/Enkompass Access Level

    Root Administrator

    Default Re: ODBC connection error for fetching value from MSsql to MYsql

    There probably is, but I doubt most people in the Linux area would know what it happens to be. Will you be posting over in the Windows section?
    cPResources: Support Options | More Support Options | Forums Search | cPanel.net Site Search | Mailing Lists(Alt) | Docs
    -- Tristan, Forums Technical Analyst, cPanel Tech Support

    Submit a ticket | Check an existing ticket

  8. #8
    Member
    Join Date
    Sep 2011
    Posts
    12
    cPanel/Enkompass Access Level

    Root Administrator

    Default ODBC connection error for fetching value from MSsql to MYsql (new error)

    hey,
    the driver error is solved with the help of this topic

    http://forums.cpanel.net/f354/adding...php-66644.html

    but now its giving this error

    Fatal error: Call to undefined function odbc_connect() in /home/frendzho/public_html/xxx.co.cc/mssql.php on line 5


    any solution for this??

  9. #9
    cPanel Staff cPanelTristan's Avatar
    Join Date
    Oct 2010
    Location
    somewhere over the rainbow
    Posts
    6,305
    cPanel/Enkompass Access Level

    Root Administrator

    Default Re: ODBC connection error for fetching value from MSsql to MYsql

    What exactly did you do to fix the error? That topic is a full guide and doesn't specifically address the error you mentioned. If you would be able to provide specifics, that would be greatly appreciated.

    Next, have you installed all the components mentioned in this guide?

    How To: Install mssql extension for php on unix « How to Get it Working

    unixODBC would be used for ODBC.
    cPResources: Support Options | More Support Options | Forums Search | cPanel.net Site Search | Mailing Lists(Alt) | Docs
    -- Tristan, Forums Technical Analyst, cPanel Tech Support

    Submit a ticket | Check an existing ticket

  10. #10
    Member
    Join Date
    Sep 2011
    Posts
    12
    cPanel/Enkompass Access Level

    Root Administrator

    Default Re: ODBC connection error for fetching value from MSsql to MYsql

    i have done this
    Code:
    INSTALLING FREETDS
    
    1-. Download freetds -> www.freetds.org
    2-. tar -zxvf freetds-stable-tgz
    3-. cd freetds-*
    4-. ./configure --prefix=/usr/local/freetds --with-tdsver=8.0 --enable-msdblib --enable-dbmfix --with-gnu-ld
    
    Note: tdsver=8.0 if you use SQL 2000, tdsver=7.0 if you use SQL 7.0
    
    5-. make
    6-. make install
    7-. /usr/local/freetds/bin/tsql -S <ip of the server> -U <User SQL>
    
    Note: For default User SQL is sa and the it have not password
    For example: /usr/local/freetds/bin/tsql -S 198.168.100.2 -U sa
    
    8-. Add the next text in freetds.conf ( /usr/local/freetds/etc )
    [TDS]
    host = <ip of the Server with Sql>
    port = 1433
    tds version = 8.0
    
    Note: If you use SQL 2000 then tds version = 8.0
    if you use SQL 7.0 then tds version = 7.0
    
    9-. Add the following line in the file /etc/ld.so.conf and run ldconfig -v:
    include /usr/local/freetds/lib
    
    10- Recompile PHP with --with-mssql=/usr/local/freetds flag.
    Create a file called all_php4 or all_php5 in:
    
    /var/cpanel/easy/apache/rawopts/
    
    The file doesnt exist by default, just create it and add the line to the file:
    --with-mssql=/usr/local/freetds
    
    11- Copy entire folder where you uncompress the Freetds in my case was /root to:
    
    /usr/local/freetds
    
    12- Go to /usr/local/freetds/src/tds/.libs/ and copy libtds.a to /usr/local/freetds/lib
    
    I do that, because when im trying Recompile PHP send me this error:
    
    checking for MSSQL support via FreeTDS... yes
    configure: error: Could not find /usr/local/freetds/lib/libtds.a
    
    13- Then go to WHM >> Main >> Software >> Apache Update
    Select: Previously Saved Config (** DEFAULT **)
    and press
    Build Profile Now.
    but when building apache it gives this error

    Code:
    checking for Oracle Database OCI8 support... no
    /include/sqlext.h' not found!... configure: error: ODBC header file '/usr
    !! './configure --disable-fileinfo --enable-bcmath --enable-calendar --enable-ftp --enable-gd-native-ttf --enable-libxml --enable-magic-quotes --enable-mbstring --enable-pdo=shared --enable-sockets --enable-zip --prefix=/usr/local --with-apxs2=/usr/local/apache/bin/apxs --with-curl=/opt/curlssl/ --with-freetype-dir=/usr --with-gd --with-imap=/opt/php_with_imap_client/ --with-imap-ssl=/usr --with-jpeg-dir=/usr --with-kerberos --with-libxml-dir=/opt/xml2/ --with-mssql=/usr/local/freetds --with-mysql=/usr --with-mysql-sock=/var/lib/mysql/mysql.sock --with-mysqli=/usr/bin/mysql_config --with-openssl=/usr --with-openssl-dir=/usr --with-pcre-regex=/opt/pcre --with-pdo-mysql=shared --with-pdo-sqlite=shared --with-png- --with-xpm-dir=/usr --with-zlib --with-zlib-dir=/usr' failed with exit code '256' !!
    !! Restoring original working apache !!
    !! Executing '/scripts/initsslhttpd' !!
    !! Restarting 'httpd' ... !!
    !! 'httpd' restart complete. !!
    Building global cache for cpanel...Done
    !! Executing '/scripts/initfpsuexec' !!
    !! Executing '/scripts/initsslhttpd' !!
    !! Executing '/scripts/update_apachectl' !!
    Compiling report...
    seems something wrong with /var/cpanel/easy/apache/rawopts/all_php5 file

    it contains
    Code:
    --with-unixODBC=/usr
    --with-mssql=/usr/local/freetds
    something is wrong with path of unixODBC in all_php5 file, as per my knowledge.

    thanks

  11. #11
    cPanel Staff cPanelTristan's Avatar
    Join Date
    Oct 2010
    Location
    somewhere over the rainbow
    Posts
    6,305
    cPanel/Enkompass Access Level

    Root Administrator

    Default Re: ODBC connection error for fetching value from MSsql to MYsql

    The linked guide suggests manually compiling in unixODBC support:

    cd /
    wget http://www.unixodbc.org/unixODBC-2.2.12.tar.gz
    tar -xvzf unixODBC-2.2.12.tar.gz
    unixODBC-2.2.12
    ./configure -prefix=/usr/local -enable-gui=no
    make && make install

    Also, if you need OCI8 support, I have a thread where I discuss how to install it:

    http://forums.cpanel.net/f145/oracle...ml#post1018981

    I believe you likely need to install the other components as well that How To: Install mssql extension for php on unix « How to Get it Working mentions in the order it mentions. If you skip a step, things are unlikely to work.
    cPResources: Support Options | More Support Options | Forums Search | cPanel.net Site Search | Mailing Lists(Alt) | Docs
    -- Tristan, Forums Technical Analyst, cPanel Tech Support

    Submit a ticket | Check an existing ticket

  12. #12
    Member
    Join Date
    Sep 2011
    Posts
    12
    cPanel/Enkompass Access Level

    Root Administrator

    Default Re: ODBC connection error for fetching value from MSsql to MYsql

    Quote Originally Posted by cPanelTristan View Post
    The linked guide suggests manually compiling in unixODBC support:

    cd /
    wget http://www.unixodbc.org/unixODBC-2.2.12.tar.gz
    tar -xvzf unixODBC-2.2.12.tar.gz
    unixODBC-2.2.12
    ./configure -prefix=/usr/local -enable-gui=no
    make && make install

    Also, if you need OCI8 support, I have a thread where I discuss how to install it:

    http://forums.cpanel.net/f145/oracle...ml#post1018981

    I believe you likely need to install the other components as well that How To: Install mssql extension for php on unix « How to Get it Working mentions in the order it mentions. If you skip a step, things are unlikely to work.
    i dont need OCI8 ,
    and i have done the same thing as per howtogetitworking , but the phpinfo is not showing "ODBC" section, means something is going wrong when apache is compiling,
    and the error is
    Code:
    /include/sqlext.h' not found!... configure: error: ODBC header file '/usr
    so, how to make that sqlext.h file there??

    unixODBC + freeTDS is already installed and configured.
    now the problem is phpinfo is not showing ODBC section means its not loaded.
    how to get it loaded with apache?

  13. #13
    cPanel Staff cPanelTristan's Avatar
    Join Date
    Oct 2010
    Location
    somewhere over the rainbow
    Posts
    6,305
    cPanel/Enkompass Access Level

    Root Administrator

    Default Re: ODBC connection error for fetching value from MSsql to MYsql

    I've provided my suggestions to re-follow that guide exactly. I don't have any further suggestions if that is not how it would be handled, since that guide doesn't suggest using all_php5 for compiling unixODBC and it also doesn't suggest using odbc.so to connect.
    cPResources: Support Options | More Support Options | Forums Search | cPanel.net Site Search | Mailing Lists(Alt) | Docs
    -- Tristan, Forums Technical Analyst, cPanel Tech Support

    Submit a ticket | Check an existing ticket

  14. #14
    Member
    Join Date
    Sep 2011
    Posts
    12
    cPanel/Enkompass Access Level

    Root Administrator

    Default Re: ODBC connection error for fetching value from MSsql to MYsql

    Quote Originally Posted by cPanelTristan View Post
    I've provided my suggestions to re-follow that guide exactly. I don't have any further suggestions if that is not how it would be handled, since that guide doesn't suggest using all_php5 for compiling unixODBC and it also doesn't suggest using odbc.so to connect.
    i have done the same as that site again,

    but still getting the same error,
    you can see the live page on www.muktacinemas.co.cc/mssql.php

    also here is phpinfo : phpinfo()

    in phpinfo, its not showing ODBC sections, thats why i am asking you what to do to add / enable ODBC,
    i have removed that opt file (all_php5) and recompiled apache, but still its giving error.

    if you want root access for checking, i can give it to you also.

  15. #15
    cPanel Staff cPanelTristan's Avatar
    Join Date
    Oct 2010
    Location
    somewhere over the rainbow
    Posts
    6,305
    cPanel/Enkompass Access Level

    Root Administrator

    Default Re: ODBC connection error for fetching value from MSsql to MYsql

    We cannot accept root access via the forums due to the security implications (even from PM). The guide doesn't suggest to try to connect using odbc_connect but to configure the settings in the unixODBC files. I see nowhere in that guide where the type of script you are using would be supported by it.
    cPResources: Support Options | More Support Options | Forums Search | cPanel.net Site Search | Mailing Lists(Alt) | Docs
    -- Tristan, Forums Technical Analyst, cPanel Tech Support

    Submit a ticket | Check an existing ticket

Similar Threads & Tags
Similar threads

  1. ODBC or DWCS4, DWCS5 Error 1045, with MySQL.
    By Elliot Balanza in forum Database Discussions
    Replies: 2
    Last Post: 10-07-2011, 08:58 AM
  2. cPanel/WHM ODBC configuration for remote connection
    By netearth in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 07-17-2009, 07:24 AM
  3. odbc for connection
    By modom in forum cPanel and WHM Discussions
    Replies: 14
    Last Post: 05-03-2009, 06:19 PM
  4. ODBC connection
    By go4kpo in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 11-16-2005, 03:42 AM
  5. ODBC or MSSQL connection with php under cpanel
    By kirkmiesle in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 07-30-2004, 08:22 AM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube