ODBC connection error for fetching value from MSsql to MYsql

Status
Not open for further replies.

dhruvpandit

Member
21
2011
0
0
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
frown.gif


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



Any and all suggestion would be gratefuly received.


progress :

i have installed unixODBC and freeTDS .
now i am very confusing about configuring them.
i am getting this error via my current configs


obdc.ini (/etc)
Code:
[TDS]
Driver = TDS
Description = MS SQL Test
Trace = Yes
TraceFile = /tmp/mstest.log
Servername = REMOTE SERVER IP
Port = 1433
obdcinst.ini (/etc)
Code:
# Example driver definitions

# Driver from the postgresql-odbc package
# Setup from the unixODBC package
[PostgreSQL]
Description    = ODBC for PostgreSQL
Driver        = /usr/lib/psqlodbc.so
Setup        = /usr/lib/libodbcpsqlS.so
Driver64    = /usr/lib64/psqlodbc.so
Setup64        = /usr/lib64/libodbcpsqlS.so
FileUsage    = 1


# Driver from the mysql-connector-odbc package
# Setup from the unixODBC package
[MySQL]
Description    = ODBC for MySQL
Driver        = /usr/lib/libmyodbc5.so
Setup        = /usr/lib/libodbcmyS.so
Driver64    = /usr/lib64/libmyodbc5.so
Setup64        = /usr/lib64/libodbcmyS.so
FileUsage    = 1


[TDS]
Description = FreeTDS driver
Driver = /usr/local/lib/libtdsodbc.so
Setup = /usr/local/lib/libtdsodbc.so
Trace = Yes
TraceFile = /tmp/freetds.log
FileUsage = 1
freetds.conf (/root/freetds-0.91)
Code:
#   $Id: freetds.conf,v 1.12 2007/12/25 06:02:36 jklowden Exp $
#
# This file is installed by FreeTDS if no file by the same 
# name is found in the installation directory.  
#
# For information about the layout of this file and its settings, 
# see the freetds.conf manpage "man freetds.conf".  

# Global settings are overridden by those in a database
# server specific section
[global]
        # TDS protocol version
;    tds version = 4.2

    # Whether to write a TDSDUMP file for diagnostic purposes
    # (setting this to /tmp is insecure on a multi-user system)
;    dump file = /tmp/freetds.log
;    debug flags = 0xffff

    # Command and connection timeouts
;    timeout = 10
;    connect timeout = 10
    
    # If you get out-of-memory errors, it may mean that your client
    # is trying to allocate a huge buffer for a TEXT field.  
    # Try setting 'text size' to a more reasonable limit 
    text size = 64512

# A typical Sybase server
[egServer50]
    host = symachine.domain.com
    port = 5000
    tds version = 5.0

# A typical Microsoft server
[TDS]
    host = REMOTE SERVER IP
    port = 1433
    tds version = 7.2


here is my php file code
Code:
<?php 
$dsn = "Driver={SQL Server};Server=REMOTE SERVER IP;Database=DB NAME;";
$user = 'USERNAME';
$pass = 'PASSWORD';
$conn = odbc_connect($dsn, $user, $pass);
if($conn){
echo "I got it!.";
}
 $sql="Select * From View_Cities";
$rs=odbc_exec($conn,$sql);
if (!$rs)
  {exit("Error in SQL");}
echo "<table><tr>";
echo "<th>FilmId</th>";
echo "<th>FilmName</th></tr>";
while (odbc_fetch_row($rs))
  {
  $FilmId=odbc_result($rs,"CityId");
  $FilmName=odbc_result($rs,"CityName");
  echo "<tr><td>$FilmId</td>";
  echo "<td>$FilmName</td></tr>";
  }
odbc_close($conn);
echo "</table>";


?>



AND here is the output @ my centos cPanel server

Code:
[B]Warning[/B]:  odbc_connect() [[URL="http://www.muktacinemas.******/function.odbc-connect"]function.odbc-connect[/URL]]:  SQL error: [unixODBC][Driver Manager]Data source name not found, and no  default driver specified, SQL state IM002 in SQLConnect in [B]/home/frendzho/public_html/xxxx.******/mssql.php[/B] on line [B]5[/B]

[B]Warning[/B]:  odbc_exec() expects parameter 1 to be resource, boolean given in [B]/home/frendzho/public_html/xxxx.******/mssql.php[/B] on line [B]10[/B]
Error in SQL
 
Status
Not open for further replies.
Back
Top