AXISHK
asked on
Install TDS on Centos
I have setup a testing Centos and try to setup the TDS and ODBC on my Centos in order to connect to MS SQL Server.
1. yum install unixODBC.x86_64
2. wget ftp://ftp.freetds.org/pub/freetds/stable/freetds-stable.tgz
./configure --prefix=/usr/local
make
make install
Configure the /usr/local/etc/freetds.con f and connect to MS SQL, it works fine.
Checking my production server, there is also ODBC setting.(odbc.ini) that refer a driver : /usr/local/lib/libtdsodbc. so. However, I can't find this library in my testing Centos. Should it be installed with steps mentioned below.
What's the usage for this odbc.ini ? Seem like setting up the freetds.conf can connect to MS SQL ? Any idea ?
Thanks
1. yum install unixODBC.x86_64
2. wget ftp://ftp.freetds.org/pub/freetds/stable/freetds-stable.tgz
./configure --prefix=/usr/local
make
make install
Configure the /usr/local/etc/freetds.con
Checking my production server, there is also ODBC setting.(odbc.ini) that refer a driver : /usr/local/lib/libtdsodbc.
What's the usage for this odbc.ini ? Seem like setting up the freetds.conf can connect to MS SQL ? Any idea ?
Thanks
The file odbcinst is using is odbcinst.ini
You could try adding the -l /etc/odbc.ini
Reference http://csurs.csr.uky.edu/cgi-bin/man/man2html?1+odbcinst
You could try adding the -l /etc/odbc.ini
Reference http://csurs.csr.uky.edu/cgi-bin/man/man2html?1+odbcinst
ASKER
odbcinst -i -s -f tds.datasource.template -l /etc/odbc.ini
It doesn't make any different. File odbc.ini does not created under /etc/
Tks
It doesn't make any different. File odbc.ini does not created under /etc/
Tks
I have not used it, but which of your applications/programs rely on odbc.ini and are not working because of that?
There was a commercial ODBC driver and everything relied on the /etc/odbc.ini file for the connection.
your system with freetds has odbcinst.ini which reflects the same set of information.
You could hard link odbcinst.ini to odbc.ini
rm /etc/odbc.ini ; ln /etc/odbcinst.ini /etc/odbc.ini
There was a commercial ODBC driver and everything relied on the /etc/odbc.ini file for the connection.
your system with freetds has odbcinst.ini which reflects the same set of information.
You could hard link odbcinst.ini to odbc.ini
rm /etc/odbc.ini ; ln /etc/odbcinst.ini /etc/odbc.ini
ASKER
The production server has been setup for PHP to access the SQL Server and I believe we will just follow it.
http://www.get-the-solution.net/index-blog-1-14-118-freetds+odbc+Datas+%5BS1000%5D%5BunixODBC%5D%5BFreeTDS%5D%5BSQL+Server%5DUnable+to+connect+to+data+source.html
The FreeTDS connection works fine (with tsql), but I can't access through UnixODBC. It pops out "Unable to connect to data source".
http://www.get-the-solution.net/index-blog-1-14-118-freetds+odbc+Datas+%5BS1000%5D%5BunixODBC%5D%5BFreeTDS%5D%5BSQL+Server%5DUnable+to+connect+to+data+source.html
The FreeTDS connection works fine (with tsql), but I can't access through UnixODBC. It pops out "Unable to connect to data source".
Hard link the odbcinst.ini to odbc.ini and see if that resolves you issue.
Do you have the template you used with odbcinst?
Do you have the template you used with odbcinst?
ASKER
Doesn't help.
[root@myweb etc]# cat tds.datasource.template
[SMS_SRV]
Driver = FreeTDS
Description = ODBC connection via FreeTDS
Trace = No
Server = 10.131.28.22
Port = 1433
TDS Version = 8.0
[root@myweb etc]# cat tds.driver.template
[FreeTDS]
Description=v0.63 with protocol v8.0
Driver = /usr/local/lib/libtdsodbc. so
[root@myweb etc]#
[root@myweb etc]# cat tds.datasource.template
[SMS_SRV]
Driver = FreeTDS
Description = ODBC connection via FreeTDS
Trace = No
Server = 10.131.28.22
Port = 1433
TDS Version = 8.0
[root@myweb etc]# cat tds.driver.template
[FreeTDS]
Description=v0.63 with protocol v8.0
Driver = /usr/local/lib/libtdsodbc.
[root@myweb etc]#
Look at odbcinst.ini
Create an entry for the server you want to access there based on example present there.
You have an example how the server has to be defined within either file.
I think, are you working on he basis that running odbcinst will create the appropriate entry for you?
Create an entry for the server you want to access there based on example present there.
You have an example how the server has to be defined within either file.
I think, are you working on he basis that running odbcinst will create the appropriate entry for you?
ASKER
odbcinst.ini & odbc.ini have the entry inside. Can't find anything wrong on the entry.
TDS setup should be correct as I can use tsql command to login to the MS SQL. Only the UnixODBC shouldn't be setup but I have review odbc.ini & odbcinst.ini. Can't identify any problem..
[root@myweb ~]# isql -v HPSMS_SRV sa xxxxx
[S1000][unixODBC][FreeTDS] [SQL Server]Unable to connect to data source
[01000][unixODBC][FreeTDS] [SQL Server]Unexpected EOF from the server
[01000][unixODBC][FreeTDS] [SQL Server]Adaptive Server connection failed
[ISQL]ERROR: Could not SQLConnect
[root@myweb ~]#
Tks
TDS setup should be correct as I can use tsql command to login to the MS SQL. Only the UnixODBC shouldn't be setup but I have review odbc.ini & odbcinst.ini. Can't identify any problem..
[root@myweb ~]# isql -v HPSMS_SRV sa xxxxx
[S1000][unixODBC][FreeTDS]
[01000][unixODBC][FreeTDS]
[01000][unixODBC][FreeTDS]
[ISQL]ERROR: Could not SQLConnect
[root@myweb ~]#
Tks
odbcinst -i -d -f tds.datasource.template
is this what you have in the odbcinst.ini
Is this what you have in freeTDS.conf
The entries that are added to odbcinst.ini provide an example on creating note the last two entries in /etc/odbcinst.ini
is this what you have in the odbcinst.ini
[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
[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
[Registrar]
Driver = FreeTDS
Description = UCLA Registrar (SRDB)
Trace = No
Server = srdb.registrar.ucla.edu
Port = 1433
Create file tds.datasource.template: =
UsageCount = 1
[FreeTDS]
Description = v0.63 with protocol v8.0
Driver = /usr/lib/libtdsodbc.so
UsageCount = 1
Is this what you have in freeTDS.conf
# $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
[egServer70]
host = ntmachine.domain.com
port = 1433
tds version = 7.0
The entries that are added to odbcinst.ini provide an example on creating note the last two entries in /etc/odbcinst.ini
ASKER
Those settings the the files are correct. Again, TDS works fine but not for UNIXODBC setting. Do I miss anything beside the files mentioned ? Do I miss any system file ?
Tks
/etc/odbcinst.ini
-----------------
[FreeTDS]
Description=v0.63 with protocol v8.0
Driver=/usr/local/lib/libt dsodbc.so
UsageCount=4
/etc/freetds.conf
-----------------
[HPSMS_SRV]
host = 10.131.28.22
port = 1433
tds version = 8.0
/etc/odbc.ini
-------------
[HPSMS_SRV]
Driver=/usr/local/lib/libt dsodbc.so
Description=ODBC connection via FreeTDS
Servername=HPSMS_SRV
TDS_Version=8.0
Database=SMS
tsql result
-----------
[root@myweb etc]# tsql -S HPSMS_SRV -U sa -P xxxxxx
locale is "en_US.UTF-8"
locale charset is "UTF-8"
using default charset "UTF-8"
1> quit
isql result
----------------
[root@myweb etc]# isql -v HPSMS_SRV sa xxxxxx
[S1000][unixODBC][FreeTDS] [SQL Server]Unable to connect to data source
[01000][unixODBC][FreeTDS] [SQL Server]Unexpected EOF from the server
[01000][unixODBC][FreeTDS] [SQL Server]Adaptive Server connection failed
[ISQL]ERROR: Could not SQLConnect
Tks
/etc/odbcinst.ini
-----------------
[FreeTDS]
Description=v0.63 with protocol v8.0
Driver=/usr/local/lib/libt
UsageCount=4
/etc/freetds.conf
-----------------
[HPSMS_SRV]
host = 10.131.28.22
port = 1433
tds version = 8.0
/etc/odbc.ini
-------------
[HPSMS_SRV]
Driver=/usr/local/lib/libt
Description=ODBC connection via FreeTDS
Servername=HPSMS_SRV
TDS_Version=8.0
Database=SMS
tsql result
-----------
[root@myweb etc]# tsql -S HPSMS_SRV -U sa -P xxxxxx
locale is "en_US.UTF-8"
locale charset is "UTF-8"
using default charset "UTF-8"
1> quit
isql result
----------------
[root@myweb etc]# isql -v HPSMS_SRV sa xxxxxx
[S1000][unixODBC][FreeTDS]
[01000][unixODBC][FreeTDS]
[01000][unixODBC][FreeTDS]
[ISQL]ERROR: Could not SQLConnect
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Get the same result.
However, accidentically find out that "TDSVER=8.0 isql HPSMS_SRV root xxxx –v" works fine for my old configuration.
But still looking around how to ingore "TDSVER=8.0" as I don't need that on my production server....
However, accidentically find out that "TDSVER=8.0 isql HPSMS_SRV root xxxx –v" works fine for my old configuration.
But still looking around how to ingore "TDSVER=8.0" as I don't need that on my production server....
The tds version control the interaction with sql server. Different "Versions" had issued referenced freetds references.
ASKER
Finally, fix the problem by removing a file the odbc.ini under root/.odbc.ini.
Afterwards, it could connect to the SQL server. Thanks for the information anyway.
Afterwards, it could connect to the SQL server. Thanks for the information anyway.
ASKER
http://www.unixodbc.org/doc/FreeTDS.html
I can install the libtdsodbc.so. However, run "odbcinst -i -s -f tds.datasource.template" but it can't generate any entry in odbc.ini. Any idea ?
In addition, how to odbc.so in Centos as mentioned in the article ?
Tks