Communicating with a MS SQL database from a Linux server

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
TipPro
Forum Commoner
Posts: 35
Joined: Wed Mar 15, 2006 6:39 pm

Communicating with a MS SQL database from a Linux server

Post 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
TipPro
Forum Commoner
Posts: 35
Joined: Wed Mar 15, 2006 6:39 pm

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

Post 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
Post Reply