home
training courses
why choose us?
solutions
support
company
LearnItFirst User Forum
Welcome Guest
Search
|
New Posts
|
Members
|
Log In
|
Register
SQL Server Forum - LearnItFirst.com
»
SQL Server Database Administration
»
SQL Server Security
»
SQL Server 2005 Express: Cannot connect to Server Name
SQL Server 2005 Express: Cannot connect to Server Name
Options
Previous Topic
·
Next Topic
newphpcoder
Posted:
Tuesday, September 28, 2010 7:03:51 PM
Rank: Newbie
Joined: 9/28/2010
Posts: 7
Points: -429
Where do you live?: Philippines
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.
Back to top
Scott Whigham
Posted:
Tuesday, September 28, 2010 7:09:32 PM
Rank: Super Mod
Joined: 3/20/2006
Posts: 476
Points: 1,053
Where do you live?: Dallas, TX
I would guess that it is either b/c the service isn't running or you are connecting remotely (which is disabled by default). Check that the service is started. If it is, then are you trying to connect locally or remotely?
Back to top
newphpcoder
Posted:
Wednesday, September 29, 2010 9:09:18 PM
Rank: Newbie
Joined: 9/28/2010
Posts: 7
Points: -429
Where do you live?: Philippines
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 I should use if the Username: NETBIOS NAME\Administrator Password: [no password]
This is my php code:
[PHP]
<?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');
}
}
?>
[/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 I can 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 I should do.
Thank you
Back to top
Scott Whigham
Posted:
Thursday, September 30, 2010 5:21:22 AM
Rank: Super Mod
Joined: 3/20/2006
Posts: 476
Points: 1,053
Where do you live?: Dallas, TX
No clue about PHP - sorry. Connection strings are typically pretty easy to search for though
Back to top
newphpcoder
Posted:
Thursday, October 14, 2010 10:26:26 PM
Rank: Newbie
Joined: 9/28/2010
Posts: 7
Points: -429
Where do you live?: Philippines
I try to configure the sql server I do the ff:
1. I open the SQL Server Management Studio Express
2. I connect using Windows Authentication
3. Under Databases folder where my database was there.
4. I click the plus sign on Databases
5. Then my dbtest was appearing and I click the plus sign.
6. On Security folder I click the plus sign
7. Then the Users folder was appear
8. I right click on the DOMAIN\SQLServer2005MSSQLUser$COMPUTERNAME$SQLEXPRESS.
9. On the General Tab-> Ownded Schemas I try to check the db_accessadmin and also I accidentall check the checkbox of db_owner and db_securityadmin. And Role Members I check also the db_accessadmin.
After that I reboot the server.
Then i run again my webpage.
And the result is:
Cannot select DB
Before I configure my sql server the output of my codes is:
MSSQL error.The several principal "[domain name]\IUSR_[computer name]" is not able to access the databse "database name" under the current security context.
After that I configure again my sql server to uncheck the checkboxes that I checked before. And I don't know why on the Owned Schema the checkboxex that I check was hiding so I can edit it, but on the Role members I uncheck the db_accessadmin.
I don't have any idea to fix my error: I really needed to fix it but I don't know what to do and I'm a little bit scared to configure the sql server, because I am new user of it.
Back to top
Scott Whigham
Posted:
Friday, October 15, 2010 6:14:02 AM
Rank: Super Mod
Joined: 3/20/2006
Posts: 476
Points: 1,053
Where do you live?: Dallas, TX
As I mentioned before, I have no clue about PHP w/ SQL Server. If you have a question unrelated to PHP, I can help.
Back to top
Users browsing this topic
Guest
Forum Jump
SQL Server Database Administration
- General SQL Database Question & Answer
- Backup, Recovery and Disaster Recovery
- SQL Server Security
- Integration Services (SSIS) and DTS
Transact-SQL Programming
- DML (SELECT, INSERT, UPDATE, DELETE) Questions
- Stored Procedures, Triggers, & Functions
SQL Server Scripts, Code Samples and SSMS Custom Reports
- All SQL Server Versions
- SQL Server 2005/2008
- SQL Server Management Studio Custom Reports
Customer Service
- Video Requests
You
cannot
post new topics in this forum.
You
cannot
reply to topics in this forum.
You
cannot
delete your posts in this forum.
You
cannot
edit your posts in this forum.
You
cannot
create polls in this forum.
You
cannot
vote in polls in this forum.
SQL Server 2005 DBA Training Videos
SQL Server 2008 DBA Training Videos
Email this topic
RSS Feed
Watch this topic
Print this topic
Normal
Threaded