473,473 Members | 1,581 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

PHP MS SQL connection error

darksteel21
36 New Member
Hi All,

i am trying to connect to a MS SQL Server using PHP on a Sun Solaris server. Currently I am using FreeTDS in connecting PHP to MsSQL. But i am having this error message:
Warning: mssql_connect() [function.mssql-connect]: Unable to connect to server:

Can anyone help me.

Thanks,

Mark Tan
Dec 28 '10 #1
5 3538
Dormilich
8,658 Recognized Expert Moderator Expert
do you get an SQLSTATE error code with that? you could try to connect via PDO, that normally throws more descriptive errors.
Dec 28 '10 #2
darksteel21
36 New Member
I guess my current PHP was not compiled with PDO support. And i am not familiar with PDO. I've succesfully installed FreeTDS on our Solaris server and i could connect in MSSQL server using FreeTDS with these commands :
/usr/local/freetds/bin/tsql -S <ip of our MS SQL server> -U <User SQL> -P<Password>
But when i try to connect using a php script :
$con = mssql_connect([server], [username], [password]") or die("can't connect to MS SQL Server Error: " . mssql_get_last_message());
i am having these errors : Warning: mssql_connect() [function.mssql-connect]: Unable to connect to server:
i already recompiled my php with :
--with-mssql
what seems to be the problem?did i overlooked some php configurations and settings?
Dec 29 '10 #3
Dormilich
8,658 Recognized Expert Moderator Expert
I guess my current PHP was not compiled with PDO support.
which PHP version do you have?

without a better error message I cannot really tell, maybe you can get a clue from the mssql settings in php.ini. I can imagine that you have to tell PHP to use FreeTDS. on the other hand side, if you have PHP 5.2+, PHP has PDO support by default and PDO does connect to MSSQL (given the MSSQL/DBLIB Driver is installed)

EDIT: read the 3rd user comment here, it seems to deal with your issue.
Dec 29 '10 #4
darksteel21
36 New Member
Oh i see... I am using PHP 5.1 and already told PHP to use FreeTDS with : --with-mssql=/usr/local/freetds configuration, if i upgrade my current PHP there might be a lot of changes and affected web apps on our porduction server. I'll try to look at the PDO. But why theres a notification on (http://www.php.net/manual/en/ref.pdo-dblib.php) php.net saying :
WARNING
This extension is EXPERIMENTAL. The behaviour of this extension including the names of its functions and any other documentation surrounding this extension may change without notice in a future release of PHP. This extension should be used at your own risk.
Dec 30 '10 #5
Dormilich
8,658 Recognized Expert Moderator Expert
further down they recommend using the DBLIB driver for MS SQL.
Dec 30 '10 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: wolverine1654 | last post by:
I have an application that we are moving to a 2003 server using IIS6. Currently, it works fine with IIS5 on a NT server. When I try to log into the application and connect to an Oracle DB, I get...
1
by: Mark Day | last post by:
Hi All, I have an application that links tables to an ODBC source. The DSN parameters are obtained from a custom .ini file. An incorrect DSN string gives the user a 'friendly' connection error...
1
by: PJ | last post by:
I'm getting an error message when posting information from my asp page to the database. This is the error message: DODB.Connection error '800a0e7c' Parameter object is improperly defined....
1
by: Agnes | last post by:
I got sql statment "select a,,,,,,z from myTable " (26 fields, 4 fields 's size is nvarchar(200) ) When the table got over 5000 records and I want to fill in the dataset. It will show "internal...
0
by: rhepsi | last post by:
Dear All, Im vb.net 1.1, When im trying to update the records from mysql to postgresql, the connection error: the following code is Update data button click: Dim myPgrConnect As...
5
by: icegray | last post by:
Hi, I am new about C# and MS SQL. I have done a new program which use MS SQL Database and I've install it to a new computer. But program doesn't run on new computer. I give SQL Server Connection...
0
by: =?Utf-8?B?UmljaGFyZCBC?= | last post by:
We have been receiving a connection error at one of our sites, our application works elsewhere. The error occurs when our application written in vb.net 2.0 running as a Windows Service under the...
2
sonu5588
by: sonu5588 | last post by:
I am facing problem in connection. This code is OK , when i Deploy or Create a EXE of this project and install it on other system then the connection error generates, whats the solution to create a...
3
by: mvjohn100 | last post by:
When I found " Too many connection error" may occur because of mysql default allowed maximum connection of 100. I changed it to a big value. but even my fedora shows the same error what are the...
0
by: cwinay | last post by:
Hi, I'm using hibernate, mysql 5.0.22 and struts 2 in my application. In struts2, I'm using REST plugin and classes that extends ActionSupport and implements ModelDriven interface (webservice...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.