SQL Server 2005 Express: Cannot connect to Server Name


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: SQL Server 2005 Express: Cannot connect to Server Name

  1. #1
    Join Date
    Sep 2010
    Posts
    10

    SQL Server 2005 Express: Cannot connect to Server Name

    Good day!
    I am newly in SQL Server 2005 and now I encountered error when i try to login. This is some of the information:

    Microsoft SQL Server 2005 Express Edition

    Server Type: Database Engine
    Servername:Servername\MSFW
    Authentication:SQL Server Authentication
    Login: sa
    Password:xxxx

    and when i press the connect button the error appear:

    Error:
    Cannot connect to Servername\MSFW

    Additional Information:
    An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may because by the fact that under the default settings SQL Server does not allow remote connections. (Providers Network Interfaces error: 26-Error Locating Server/Instance Specified) (Microsoft SQL Server).

    I have no idea how i can solve this problem.

    Any help is highly appreciated.

    Thank you in advance.

  2. #2
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,666
    Welcome to DevX

    The first question I was going to ask was if you had remote connections enabled, but you answered that so...I think this should get you going.
    I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
    Please use [Code]your code goes in here[/Code] tags when posting code.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    Modifications Required For VB6 Apps To Work On Vista

  3. #3
    Join Date
    Sep 2010
    Posts
    10
    Quote Originally Posted by Hack View Post
    Welcome to DevX

    The first question I was going to ask was if you had remote connections enabled, but you answered that so...I think this should get you going.
    Actually,now i only test my webpage in a computer that i create as a server. And also i'm not too familiar in a server. Now I created a database in SQL Server 2005 Express and some of information i will share is:

    Server Type: Database Engine
    Server name: ComputerName\SQLEXPRESS
    Authentication: Windows Authentication
    Username: NETBIOS NAME\Administrator [hide]
    Password: [hide]

    My problem is i cannot connect to my database using php and i don't know what username and password should i used if the Username: NETBIOS NAME\Administrator Password: [no password]

    this is my php code:
    PHP Code:
    <?php
    //session_start(); 
    //session_regenerate_id(); 

    //if($_SESSION['loggedin']){ 
    //the user is already logged in, lets redirect them to the other page 
      //  header("Location:company.php"); 
    //} 


    $server "Computer Name\SQLEXPRESS";
    $user "NETBIOS\Administrator";
    $pass "";
    $db_name="dbase"

    //connection to database
    $dbhandle mssql_connect($server$user$pass) or die ("Cannot connect to Server");

    //mssql_connect($server, 'sa', 'pass') or die("Cannot connect to server"); 
    $selected mssql_select_db($db_name$dbhandle)or die("Cannot select DB");    


            
    $department $_POST['department'];    
            
    $username $_POST['username']; 

            
    $sql=mssql_query("SELECT `Department`, `Username` FROM `tbl_user` WHERE `Department` = '{$department}' AND Username = '{$username}'") or die(mssql_min_error_severity()); 
            
    $ct mssql_num_rows($sql); 
          
            if(
    $ct == 1) { 
    // im guessing this means that the user is valid. 
    $_SESSION['loggedin'] = true// now that the user is valid we change the session value. 
                
    $row mssql_fetch_assoc($sql);   
                
                
    //$_SESSION['username'] = $row['Username'] ;
                //$_SESSION['department'] = $row['Department'];
                
                
    $Departments=array('Accounting''Engineering''Finishing_Goods''HRAD''MIS''Packaging_and_Design''Production''Purchasing_Logistic''QA_and_Technical''Supply_Chain');
                
                if (
    in_array($row['Department'], $Departments)){
                        
    header ('Location:company.php');
                }else{
                        echo 
    "Incorrect Username or Department";
                        
    header ('Location:index.php');
                }
            }
    ?>
    I don't know if what configuration i need to do to work my connection. I configured php.ini like:

    I uncommented the following:

    extension_dir = "C:\php\ext"
    extension=php_sqlsrv_52_ts_vc6.dll
    extension=php_bz2.dll
    extension=php_curl.dll
    extension=php_dba.dll
    extension=php_exif.dll
    extension=php_gd2.dll
    extension=php_gettext.dll

    mssql.allow_persistent=On
    mssql.max_persistent=-1
    mssql_max_links=-1
    mssql.min_error_severity=10
    mssql.compatibility_mode=Off
    mssql.connect_timeout=5
    mssql.timeout=60
    mssql.textlimit=4096
    mssql.textsize=4096
    mssql.batchsize=0
    mssql.datetimeconvert=On
    mssql.secure_connetion=Off

    FreeTDS default to 4096
    mssql.max_procs=25
    mssql.charset = "ISO-8859-1"

    After i commented out that in php.ini, i put all sqlsrv file in C:\php\ext and the ntwdlib.dll into C:\WINDOWS\system32. After that still when i run my webpage the error is still there. I have no idea how can i fix that error.


    Error:
    Fatal error: call to undefined function mssql_connect() in C:\Inetpub\wwwroot\web_intranet\index.php on line 17

    I hope somebody can help or tell me what should i do..

    Thank you

Similar Threads

  1. Replies: 1
    Last Post: 02-26-2008, 02:13 PM
  2. reset sa pwd in sql server 2005 express
    By sansircar in forum Database
    Replies: 1
    Last Post: 02-08-2008, 12:41 AM
  3. Replies: 0
    Last Post: 12-20-2006, 09:50 AM
  4. Sql Server client not able to connect server
    By Noordeen in forum ASP.NET
    Replies: 0
    Last Post: 08-12-2002, 03:10 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center