Operating System - Linux
1753797 Members
7950 Online
108799 Solutions
New Discussion юеВ

Re: connect mssql database from linux machine

 
monu_1
Regular Advisor

connect mssql database from linux machine

Hi,

I want to connect MSSQLServer2k database(nltrans) on Windows2k machine(host=AGNI, ip=192,168.0.11) from linux m/c( 192.168.0.4)

Thanks
MKS
5 REPLIES 5
Rob Leadbeater
Honored Contributor

Re: connect mssql database from linux machine

Hi,

A quick Google will head you towards FreeTDS which should do what you want...
http://www.freetds.org

Cheers,

Rob
monu_1
Regular Advisor

Re: connect mssql database from linux machine

Hi Rob,
Thanks for your reply.

I have already installed freetds. But still not getting connection with sql server.

There are /etc/odbc.ini /etc/odbcinst.ini /etc/freetds.conf files but confused which file i have to use and what entries would be put according above infrastructure?

Pls suggest.

Thanks,
MKS
Rob Leadbeater
Honored Contributor

Re: connect mssql database from linux machine

The userguides for FreeTDS look fairly self explanatory:

http://www.freetds.org/userguide

If you can't figure things out, then letting us know exactly how you've got things configured, and exactly what it does when you're not getting a connection, would be useful...

Cheers,

Rob
monu_1
Regular Advisor

Re: connect mssql database from linux machine

Hi Rob,

/etc/freetds.conf
[myserver2k]
host = agni.sigma2.com
port = 1433

/etc/odbc.ini
[nltrans]
Trace = ON
Driver = ODBC
Database = nltrans
PORT = 1433

/etc/odbcinst.ini
Description = ODBC for MSSQL
Driver = /usr/lib/libodbcpsql.so
Setup = /usr/lib/libodbcpsqlS.so
FileUsage = 1
UsageCount = 1

when i connecting ----

tsql -H agni -p 1433 -U 'sigma2\administrator' -P 'password'
locale is "en_US.UTF-8"
locale charset is "UTF-8"
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


Thanks,
MKS
Rob Leadbeater
Honored Contributor

Re: connect mssql database from linux machine

Hi,

From the FAQ: http://www.freetds.org/faq.html

Connecting like so:

tsql -H hostmachine -p port -U username -P password

will bypass the freetds.conf file. Therefore check first that your hostname is reachable

# telnet agni 1433
# telnet agni.sigma2.com 1433

You should get some form of response from the server...

Cheers,

Rob