Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP][MSSQL]connect - w czym jeszcze problem...
Wykrywacz
post
Post #1





Grupa: Zarejestrowani
Postów: 726
Pomógł: 20
Dołączył: 8.12.2005
Skąd: Wrocław

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


Podpowiedzcie mi proszę bo może się spotkaliście, w czym może być jeszcze problem w ustawieniach mssql'a, że odrzuca połączenie z phpem (od unixowej strony).

Ścieżkę podaje z portem, na serwerze ustawione na enable jest "Enable Mixed Mode Authentication"

  1. $mssql = mssql_connect("SERV\INST:1433","USR","PASS");


wywala oczywiście
Cytat
Warning: mssql_connect() [function.mssql-connect]: Unable to connect to server:
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
jajcarzd1
post
Post #2





Grupa: Zarejestrowani
Postów: 215
Pomógł: 19
Dołączył: 24.12.2003
Skąd: Przemyśl

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


A ja łącze się tak

  1.  
  2.  
  3. define('USER_MsSQL', 'sa');
  4. define('PASSWORD_MsSQL', 'password');
  5. define('BASE_MsSQL', '8FR');
  6. define('ERROR_MsSQL', true);
  7. define('HOST_MsSQL', 'win2k8r2')
  8.  
  9. MsSQL::instance();
  10.  




  1.  
  2. public static function instance() {
  3.  
  4. if (null === self::$_instance) {
  5. self::$_instance = new self(USER_MsSQL,PASSWORD_MsSQL,BASE_MsSQL,ERROR_MsSQL,HOST_MsSQL);
  6. }
  7.  
  8. return self::$_instance;
  9. }
  10.  
  11. private function __construct($db_user = null, $db_pass = null, $db_baza = null, $showErrors = false, $db_host = 'localhost'){
  12.  
  13.  
  14. $this->db_host = $db_host;
  15. $this->db_user = $db_user;
  16. $this->db_pass = $db_pass;
  17. $this->db_baza = $db_baza;
  18. $this->showErrors = $showErrors;
  19.  
  20.  
  21. if(!$this->connection = @mssql_connect($this->db_host,$this->db_user,$this->db_pass)) {
  22. throw new Exception(Reports::getMessage('dbConnect').' - '.mssql_get_last_message());
  23. }
  24. if(!$this->selectdb = @mssql_select_db($this->db_baza)) {
  25. throw new Exception(Reports::getMessage('dbSelectDB').' - '.mssql_get_last_message());
  26. }
  27.  
  28.  
  29. $this->queryNo = 0;
  30. $this->activityLog = Array();
  31. $this->activityNo = 0;
  32.  
  33. }
  34.  
Go to the top of the page
+Quote Post

Posty w temacie


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

 



RSS Aktualny czas: 4.10.2025 - 13:49