connect to mssql

Hi - can any one tell me is it possible to connect to mssql and fetch the data from unix shell scripts

Install UnixODBC + FreeTDS, and use the isql utility. Try something like

isql -H hostname -U user < filename.sql

But if you would like to get the return resultset, probably you should place that part of the program in Perl instead, as it can be used with the Perl ODBC package to get the resultset through the DBI just as other database backends.

hi, i have done this, but still i am getting error "[ISQL]ERROR: Could not SQLConnect" i guess this requires a dsn which i am not aware of how to create one. thanks for letting me know that.

Cheers,
Waseem

I didn't use a DSN for connect when I used it. I just specified the host, port number, username and password and it worked for me. Make sure the SQL server accepts standard (password) authentication. i.e. mixed authentication mode rather than just Windows authentication. Maybe check the firewall also if that matters.

I will just say try to use the MSSQL Enterprise Manager or Query Analyzer to test the connection first, then if that's okay try do so with isql/tsql.