Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> Podłącznie do MS SQL 2012 - błąd połączenia
IceManSpy
post 8.06.2013, 18:35:42
Post #1





Grupa: Zarejestrowani
Postów: 1 006
Pomógł: 111
Dołączył: 23.07.2010
Skąd: Kraków

Ostrzeżenie: (0%)
-----


Cześć

Próbuję podłączyć się pod server MS SQL 2012 po localhost. Robieto wszystko na wirtualnej maszynie, żeby było jak najmniej problemów. Świeży Windows, świeży MS SQL Server 2012 i XAMPP w wersji 1.8.1 .
Dodatkowo ściągnięty driver:
http://www.microsoft.com/en-us/download/de...s.aspx?id=20098
Wrzucone dll do folderu ext i dodane do php.ini -> apache uruchomił się jak należy.

Teraz kod PHP:
  1. $serverName = ".\\MSSQLSERVER";
  2. $connectionInfo = array( "Database"=>"lekarstwa", "UID"=>"damian", "PWD"=>"qweasd");
  3. $conn = sqlsrv_connect( $serverName, $connectionInfo);
  4.  
  5. if( $conn ) {
  6. echo "Connection established.<br />";
  7. }else{
  8. echo "Connection could not be established.<br />";
  9. die( print_r( sqlsrv_errors(), true));
  10. }


Otrzymuje taki błąd:
Cytat
Connection could not be established.
Array ( [0] => Array ( [0] => 08001 [SQLSTATE] => 08001 [1] => 87 [code] => 87 [2] => [Microsoft][SQL Server Native Client 11.0]SQL Server Network Interfaces: Connection string is not valid [87]. [message] => [Microsoft][SQL Server Native Client 11.0]SQL Server Network Interfaces: Connection string is not valid [87]. ) [1] => Array ( [0] => HYT00 [SQLSTATE] => HYT00 [1] => 0 [code] => 0 [2] => [Microsoft][SQL Server Native Client 11.0]Login timeout expired [message] => [Microsoft][SQL Server Native Client 11.0]Login timeout expired ) [2] => Array ( [0] => 08001 [SQLSTATE] => 08001 [1] => 87 [code] => 87 [2] => [Microsoft][SQL Server Native Client 11.0]A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online. [message] => [Microsoft][SQL Server Native Client 11.0]A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online. ) )


Wszystko związane z podłączeniem z zewnatrz (chociaż robię to na localhost) zrobiłem, a przynajmniej co google podpowiedziało.
W czym szukać problemów?

Ten post edytował IceManSpy 8.06.2013, 18:41:32


--------------------
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 16.04.2024 - 23:11