8 Replies - 710 Views - Last Post: 03 August 2012 - 11:06 AM Rate Topic: -----

#1 notice88  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 81
  • Joined: 21-December 11

I can't connect to mssql server 2008

Posted 03 August 2012 - 09:28 AM

I can't connect to mssql server. I installed oracle 11g express lately, but im not sure if it conflicts from the mssql. Im using wamp server and im sure that i already activated the extensions needed for mssql like "php_mssql" and "php_pdo_mssql" only this two extensions i think... Im sure that the values for logging in is correct because I didn't change something since I install oracle. my error is "Warning: mssql_connect() [function.mssql-connect]: Unable to connect to server: .\SQLExpress in C:\wamp\www\iCAMP\DMS\connect.php on line 16"

line 16 is "$sqlLink=mssql_connect($sHost, $sUser , $sPassword)or die("Couldn't connect to SQL Server on $myServer. Error: " . mssql_get_last_message());"

I already uninstall the oracle but still not working.. any suggestions?




        $sUser = "sa";

	$sHost = ".\SQLExpress";
	$sPassword = "Password123";
	$sDb = "DMS";

	$sqlLink=mssql_connect($sHost, $sUser , $sPassword)or die("Couldn't connect to SQL Server on $myServer. Error: " . mssql_get_last_message());
    if(!$sqlLink) 	
	{
		die('Failed to connect to server: ' .mssql_error());
	}
		
		
	//Select database
	$sqlDb2=mssql_select_db( $sDb )or die();
	if(!$sqlDb2) 
	{
		die("Unable to select database");



Is This A Good Question/Topic? 0
  • +

Replies To: I can't connect to mssql server 2008

#2 modi123_1  Icon User is offline

  • Suitor #2
  • member icon



Reputation: 6489
  • View blog
  • Posts: 23,571
  • Joined: 12-June 08

Re: I can't connect to mssql server 2008

Posted 03 August 2012 - 09:32 AM

you are certain the mysql service is running, right?
Was This Post Helpful? 1
  • +
  • -

#3 notice88  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 81
  • Joined: 21-December 11

Re: I can't connect to mssql server 2008

Posted 03 August 2012 - 09:41 AM

View Postmodi123_1, on 03 August 2012 - 09:32 AM, said:

you are certain the mysql service is running, right?


Do you mean mssql or really mysql? mysql is also running.

yes. because I can query data in microsoft sql server management studio...

I set local system in the built in account and sql server agent. I also tried local service but still not working.

This post has been edited by notice88: 03 August 2012 - 09:42 AM

Was This Post Helpful? 0
  • +
  • -

#4 modi123_1  Icon User is offline

  • Suitor #2
  • member icon



Reputation: 6489
  • View blog
  • Posts: 23,571
  • Joined: 12-June 08

Re: I can't connect to mssql server 2008

Posted 03 August 2012 - 09:44 AM

okay then it's down to your host or password.. what's up with those?
Was This Post Helpful? 1
  • +
  • -

#5 notice88  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 81
  • Joined: 21-December 11

Re: I can't connect to mssql server 2008

Posted 03 August 2012 - 09:50 AM

View Postmodi123_1, on 03 August 2012 - 09:44 AM, said:

okay then it's down to your host or password.. what's up with those?


I think the the usernames , passwords and server name are fine because copy from my php code to microsoft sql server studio to login.
Was This Post Helpful? 0
  • +
  • -

#6 Atli  Icon User is online

  • D.I.C Lover
  • member icon

Reputation: 3048
  • View blog
  • Posts: 4,572
  • Joined: 08-June 10

Re: I can't connect to mssql server 2008

Posted 03 August 2012 - 09:58 AM

The error would indicate that your hostname is invalid. If it is a username or password issue, you should get an authentication error.

Is the SQL Server Browser running? The last time I dealt with MSSQL, that thing seemed to be an issue. Can't remember exactly what that issue was though... (There were a LOT of issues :P)
Was This Post Helpful? 1
  • +
  • -

#7 notice88  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 81
  • Joined: 21-December 11

Re: I can't connect to mssql server 2008

Posted 03 August 2012 - 10:06 AM

View PostAtli, on 03 August 2012 - 09:58 AM, said:

The error would indicate that your hostname is invalid. If it is a username or password issue, you should get an authentication error.

Is the SQL Server Browser running? The last time I dealt with MSSQL, that thing seemed to be an issue. Can't remember exactly what that issue was though... (There were a LOT of issues :P)


yEAH, I'm aware of that. mssql has many errors. . SQL server browser is running good. sql server is running too except the sql server agent because i can't start it


I also got blank result in mssql_get_last_message()

This post has been edited by notice88: 03 August 2012 - 10:09 AM

Was This Post Helpful? 0
  • +
  • -

#8 notice88  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 81
  • Joined: 21-December 11

Re: I can't connect to mssql server 2008

Posted 03 August 2012 - 10:33 AM

All good now.

hmmn. I just replaced all the ntwdblib.dll coming from "http://www.dlldll.com/ntwdblib.dll_download.html" all is working now. I really appreciate all your help in all of my concerns. Im going to answer later to other concerns when Im done with my project thankyou!! :)
Was This Post Helpful? 0
  • +
  • -

#9 Atli  Icon User is online

  • D.I.C Lover
  • member icon

Reputation: 3048
  • View blog
  • Posts: 4,572
  • Joined: 08-June 10

Re: I can't connect to mssql server 2008

Posted 03 August 2012 - 11:06 AM

Glad to hear that. Thanks for letting us know!

However, I can't help feeling like there is something shady about that dlldll site. I'd definitely not trust a DLL downloaded from some random website. - Isn't that just the SQL Native Client dll? You should be able to install that from a legit Microsoft download site. Like from here, I'd wager. (Scroll down to the "Microsoft SQL Server 2008 Native Client" part.)


Another thing I though I'd point out. If you are using PHP on Windows, you may want to consider using Microsoft's sqlsrv extension instead of the mssql extension. It's superior in many ways, and supports PHP 5.3 and 5.4.
Was This Post Helpful? 1
  • +
  • -

Page 1 of 1