xampp and sqlserver

Problems with the Windows version of XAMPP, questions, comments, and anything related.

xampp and sqlserver

Postby jupela » 30. October 2006 13:59

Hello,
I have a windows 2003 server with the last version of xampp, I have to connect to sqlserver through php but I have some errors. My code is the next:
--------------------------------------------------------------------------------------------------
<?php
$connectID = mssql_connect("server","user","pw");
mssql_select_db("Horaris",$connectID);
$result=mssql_query("select * from cpd_esp_espacios_i",$numero );
while ($row=mssql_fetch_array($result)) {
$counter++; $c1=$row["Alias"];
$c2=$row["Nombre"];
echo ("$counter c1: $c1 c2: $c2\n");
}
mssql_close($conectID);
?>
-------------------------------------------------------------------------------------------------
and the error is:
--------------------------------------------------------------------------------------------------
Warning: mssql_connect() [function.mssql-connect]: Unable to connect to server:
'server' in C:\Archivos de programa\xampp\htdocs\sqlserver_test\ejemplo_horaris.php on line 2
--------------------------------------------------------------------------------------------------
Someone can help me?[/i]
jupela
 
Posts: 15
Joined: 16. May 2006 12:35

Postby jupela » 31. October 2006 17:31

Now, I know what is the problem but not the solution:
The SQLServer has a 'DNS name' and 'DNS Alias' if you put in the sentence mssql_connect
the 'DNS name' the php works correctly but if you put 'DNS Alias' the php cannot find the server.
I have tested the DNS server and if with other commands like 'ping' or 'nslookup' can reach the SQL Server and all is ok.
Also, I work with xampp under Linux and there aren't problems.

Someone knows what can I do?

thanks,
jupela
 
Posts: 15
Joined: 16. May 2006 12:35

Postby Izzy » 01. November 2006 05:02

Has this FAQ item anything to do with your issue?

I do not get any connection to my MS SQL server!
http://www.apachefriends.org/en/faq-xam ... l#phpmssql
Izzy
 
Posts: 3344
Joined: 25. April 2006 17:06

Postby jupela » 02. November 2006 10:21

Yes, I put a newer "ntwdblib.dll" in the \xampp\apache\bin directory such as the FAQ article explains in http://www.apachefriends.org/en/faq-xam ... l#phpmssql
Then if you put he 'DNS name' the php works correctly but if you put 'DNS Alias' the php cannot find the server.
The script was the next:
this works:
<?
$sql = mssql_connect ("DNS_Server_name", "user", "pass") or die ("Could not connect to database:" . mssql_get_last_message());
?>

but this doesn't:
<?
$sql = mssql_connect ("DNS_Server_alias", "user", "pass") or die ("Could not connect to database:" . mssql_get_last_message());
?>


If I don't resolve this problem I cannot work with xampp.

Tanks,
jupela
 
Posts: 15
Joined: 16. May 2006 12:35

Postby jupela » 10. November 2006 12:36

For if someone needs it I have obtained a solution, with the version ntwdblib.dll-2000.80.194.0 it's works ok.
jupela
 
Posts: 15
Joined: 16. May 2006 12:35


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 137 guests