Executing MSSQL-Queries on linux fedora 8.0

Hi there,

I have two machines.
One running linux and another running windows.
I am running my web site on linux with xampp server and i want to use the database thatis mssql-2005 installed on windows.I have no option of shifting to mysql bcz fromer company database is on mssql.
So please suggest me some solution....

I hav tried connecting with FreeTDS 0.61.2.

Initially, I install FreTDS on my Fedora machine as follows:
1) unzip file by issuing the following commands:

tar xvfz FreeTDS-0.61.2.tar.gz

2)From the /public folder, issue:

cd FreeTDS-0.61.2

3) This is what I used for the installation of FreeTDS:

./configure --prefix=/usr/local/freetds --sysconfdir=/usr/local/freetds --with-tdsver=7.0 --enable-msdblib --enable-threadsafe --enable-sybase-compat

4) Next, we compile the module tree, issue the following:


And install FreeTDS by issuing:

make install

5) change directory to this folder, and issue:

cd /usr/local/freetds

6) Edit freetds.conf:

gedit freetds.conf

7) I have a windows box running MS SQL Server 2005 on it. The machine name is LAB6-16 with IP address 192.168.x.xxx. Append the following part to FreeTDS.conf, and save it:

host = 192.168.x.xxx
port =1433
tds version = 7.0

Change to the bin folder under /usr/local/freetds, and issue:

tsql -S 'LAB6-16' -H '192.168.x.xxx' -p '1433' -U 'sa' –P '123456'

BUT instead of prompting 1> it returns ERROR as follows:

locale is "en_US.UTF-8"
charset is "UTF-8"
src/tds/login.c: tds_connect: 192.168.x.xxx:1433: Network is unreachable
Msg 20009, Level 9, State 0, Server OpenClient, Line 0
Server is unavailable or does not exist.
There was a problem connecting to the server

Can any body solve this problem or is there any other way to connect MSQL 2005 with Linux.

Please reply to amanjain17@gmail.com

Hi, About your problem with

Lo'Call's picture


About your problem with Freetds, amanjain17.
I can only give you a guess based on the "error messages" and crossed with my own experience.

1st.) There is no need to configure "/etc/freetds.conf" in order to use
I can say that since I was able to make up successfulls connections
on MSSQL 7.xx and nexts from fedora 8 and 10 with the conf file
resume at its strict minimum.
This is meaning in the [global] section there was only the
"text size = 64512" pair enabled and the ALL the rest ;REMed.
This first pair is NOTHING about your problem and only have use about
some case of "out-of-memory"
The others section [egServer50] and [egServer70] are examples for
typically a Sybase server and a Microsoft server and are ONLY provided
2nd) In My case... The machine hosting the MSSQL db is "ws-21-winxp".
My command line is:
- tsql -S ws-21-winxp -U admintest4 -P "password"
and the answer is :
locale is "en_US.UTF-8"
locale charset is "UTF-8"
1> use MyDBinsteadofTheMasterOne
2> go
The following queries work to perfection.
If I connect giving the IP I MUST to specify the port too.
- tsql -H -p 1433 -U admintest4 -P "password"
If the port is not specified it does NOT connect.
That's for the LINUX side.
In the Windows side:
I had to do a couple of things too.
a) open the 1433 port on the firewall
b) run the SQL Server Network Utility
"C:\Programs Files\Microsoft SQL Server\80\Tools\binn\SVRNETCN.exe"
and make sure that :
- TCP/IP is enabled as protocol,
- Server is visible (check box)
c) the name of workstation is foundable on the LAN.

This done, it HAVE to work !

My advice is, since You use a Fedora box, install Freetds from YUM or SMART.
In the yum case:
- yum -y install freetds
In the smart case:
- smart install freetds
If smart is not installed : yum -y install smart smart-gui fedora-package-config-smart (but I believe the last package is installed auto from dependencies. ...but it cost nothing to put it too on the command line)

I close with the most important, the interpretation of the error message.
it is not an authentication problem but HOW communication could or could not be done!

found the rpm in : for (F10)

and the doc in

Gone to send you this ingo by mail too.
Hope give some help.

Geek Guide
The DevOps Toolbox

Tools and Technologies for Scale and Reliability
by Linux Journal Editor Bill Childers

Get your free copy today

Sponsored by IBM

8 Signs You're Beyond Cron

Scheduling Crontabs With an Enterprise Scheduler
On Demand
Moderated by Linux Journal Contributor Mike Diehl

Sign up and watch now

Sponsored by Skybot