Solved

freetds connection error to MSSQL

Posted on 2011-09-06
2
1,026 Views
Last Modified: 2012-06-21
I have a PHP script that makes a connection to a remote SQL Server. From the command line as root I can call the freetds command: tsql –H hostname –U username and it connects just great and I can run queries.

I have a PHP script in /var/www/html/axis/public/test.php
When I: sudo –u apache –s (change the user from root to apache) and then run my PHP script from the command line, it connects and runs the queries just great.
But when executing the same script from the web browser, it fails - the browser returns a DB Connection error. The web browser is able to connect everywhere it is supposed to and renders all the web pages that don't need an SQL connection.

apache is the user that is running httpd. I’ve confirmed this via: ps aux | grep apache

Any ideas as to why apache can execute the PHP script fine from the command line, but when the browser attempts to connect to the very same script, it fails?

Error!: SQLSTATE[HY000] Unable to connect: Adaptive Server is unavailable or does not exist (severity 9)
[/error]
0
Comment
Question by:casit
2 Comments
 

Expert Comment

by:dhrusoft
ID: 36493304
you have allow host in remote server where you want connect .

check firewall in remote server .
0
 
LVL 19

Accepted Solution

by:
Rimvis earned 500 total points
ID: 36493617
Hi casit,

>> Adaptive Server is unavailable or does not exist


Adaptive Server is NOT the same as MS SQL Server. It is a product from Sybase (now SAP), sharing same roots with MS SQL.
http://en.wikipedia.org/wiki/Adaptive_Server_Enterprise

Make sure you are connecting to the right server and using right libraries.
0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
SQL Server / Update DB? 22 36
SQL Dump exec output to table 3 21
issue with DB import 1 17
SQL 2012 clustering 9 11
This article discusses four methods for overlaying images in a container on a web page
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.

861 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question