unable to connect to mssql server
Posted by: noumian (---.lanit.ru)
Date: May 27, 2008 12:45PM

Hello everyone.
I have successfully installed WampServer 2.0c .
i have allow extension "mssql" in php.ini

i have a writte a simple script as :

$host = "x.x.x.x;
$user= 'user';
$pass = "password";
$db= "maybase";
$cnx = mssql_connect($host, $user, $pass) or die ("Can't connect to Microsoft SQL Server"winking smiley;
mssql_select_db($db, $cnx) or die ("Can't connect to Database"winking smiley;

and i get on the screen :

Warning: mssql_connect() [function.mssql-connect]: Unable to connect to server: x.x.x.x in C:\wamp\www\do\setting.php on line 14
Can't connect to Microsoft SQL Server.

where can be the problem?

Options: ReplyQuote
Re: unable to connect to mssql server
Posted by: onlinebendigo (---.gw.connect.com.au)
Date: May 27, 2008 04:25PM

did you give permission in php my admin?
ans create a user and password?

if so you will need to use these host will noemaly be local host
user root
password ""

for test i would recommend changing root password and changing it in config file

Options: ReplyQuote
Re: unable to connect to mssql server
Posted by: stevenmartin99 (---.b-ras1.blp.dublin.eircom.net)
Date: May 27, 2008 04:33PM

yes localhost is the is the host not x.x.x.x.x. and username is root , no password so leave it blank


are u ment to be using mssql? wamp uses mysql!

Steven Martin
stevenmartin99@gmail.com
stevenmartin99@hotmail.com
PampServer.com - [pampserver.com]



Edited 1 time(s). Last edit at 05/27/2008 04:34PM by stevenmartin99.

Options: ReplyQuote
Re: unable to connect to mssql server
Posted by: noumian (---.lanit.ru)
Date: May 28, 2008 07:34AM

not at all.
you did not get me.
am using that script to connect to a mssql server
x.x.x.x represent the ip of my server
there is nothing to do with root or localhost.

Options: ReplyQuote
Re: unable to connect to mssql server
Posted by: yfastud (Moderator)
Date: May 28, 2008 03:17PM

Enable dll is not enough, you need to have some other settings such as odbc, so on

Have fun,

FREE One A Day
FREE Photo
FREE Games
FREE Websites
FREE Portable GPS
FREE WAMP Guides

Options: ReplyQuote
Re: unable to connect to mssql server
Posted by: noumian (---.lanit.ru)
Date: May 28, 2008 03:51PM

odbc doent have anything to do with this.
well ia m thinking about a bug in wamp2.0c

Options: ReplyQuote
Re: unable to connect to mssql server
Posted by: stevenmartin99 (193.120.116.---)
Date: May 28, 2008 05:27PM

no bug.. U jsut dont know- what ur doinfg

Steven Martin
stevenmartin99@gmail.com
stevenmartin99@hotmail.com
PampServer.com - [pampserver.com]

Options: ReplyQuote
Re: unable to connect to mssql server
Posted by: Tanx0r (---.adsl.wanadoo.nl)
Date: June 11, 2008 10:12PM

There is no need to get nasty Steven... Shame on you.

Here is how to do it Noumian...

1. Stop all WAMP services and the SQL Server (Express) service

2. Get ntwdblib.dll version 2000.80.194.0 (http://webzila.com/dll/1/ntwdblib.zip OR get a free copy of ntwdblib.dll by downloading MS SQL Server 2000 SP4 from Microsoft Website. It contains a copy of ntwdblib.dll version 2000.80.194.0 in the system directory). Copy and replace any other versions of this file to the following locations:
a) Your PHP binaries folder (ie C:\wamp\bin\php\php5.2.6)
b) Your Apache binaries folder (ie C:\wamp\bin\apache\apache2.2.8\bin)
c) Windows\System32\

3. Configure SQL Server to accept TCP connections and Named Pipes through the SQL server configuration manager (yes you will need the client tools installed).
4. Configure SQL Server for Mixed mode authentication and remember the password you set for sa
5. Start the SQL Server Service
6. Edit your php.ini and set the mssql.secure_connection = On
7. Make sure your wamp folder has proper access rights (full control for 'everyone').
8. Start all services from the WAMP menu.

You can connect to your SQL Server instance like this:

$dbhandle = mssql_connect('.\SQLEXPRESS','username','password');
$db = mssql_select_db('databasename', $dbhandle);




Part of this was taken from some other forum.

Hoping this will help you.

Tanx0r

Options: ReplyQuote


Sorry, only registered users may post in this forum.