Page 1 of 1

Communicating with a MS SQL database from a Linux server

Posted: Sat Aug 21, 2010 2:39 pm
by TipPro
I am trying to communicate with a MS SQL database from a Linux server. I can use isql in the terminal and run any query successfully. In php I can use odbc_tables and odbc_columns and get all the table and column names in the database. Whenever I try to use odbc_exec to run queries the program never returns and just sits there waiting without returning any error message. What could possibly be causing this problem? Any ideas on how I can debug this?

The database is: Microsoft SQL Server 2000 - 8.00.760 (Intel X86) Dec 17 2002 14:22:05 Copyright (c) 1988-2003 Microsoft Corporation Desktop Engine on Windows NT 6.0 (Build 6002: Service Pack 2)

Here are my config files on the linux server...

freetds.conf

Code: Select all

[MSSERVER]
  host = <ip address>
  port = 49933
  tds version = 7.0
odbcinst.ini

Code: Select all

[TDS]
  Description = FreeTDS driver
  Driver = /user/lib64/libtdsodbc.so
  Setup = /user/lib64/libtdsodbc.so
  Fileusage = 1
odbc.ini

Code: Select all

  Driver = TDS
  Description = MS Server
  Servername = MSSERVER
  Database = <database name>
  Port = 49933

Re: Communicating with a MS SQL database from a Linux server

Posted: Mon Aug 23, 2010 8:58 am
by TipPro
It really threw me off that communication with the database was some what working but the problem turned out to be with the odbc.ini

This is the working odbc.ini

Code: Select all

  Driver = TDS
  Description = MS Server
  Server = <ip address>
  Database = <database name>
  Port = 49933