achala87 0 Newbie Poster

Hi guys,

Im running on PHP 5.3, Apache/2.2.12 (Win32 and SQL server 2008 using the sqlsrv driver 2.0.

I have no problems connecting to my db instance using either Windows or server authentication as
i Have enabled both. I use Windows auth for the application. I have enabled remote connections.

Following is my Win auth connection:

//db conn local
$connectionInfo = array('Database'=>'esoft_st_mang_db', 'ReturnDatesAsStrings'=> true);

$conn = sqlsrv_connect('myServerName', $connectionInfo);

This works and i manupilate data as need.

The system manages student information for a company and sends new records for that day from multiple branches to the head office which is on a static IP, using SQL server 2008 and on Apache. this db also has enabled remote connections.

How do I write the connection string to connect to the head office database??

I tried this:

//db conn hq
$connectionInfo_hq = array('Database'=>'esoft_st_mang_db', 'ReturnDatesAsStrings'=> true);

$conn_hq = sqlsrv_connect('ipaddress, 80', $connectionInfo_hq);

i get the error:

Array

(

  [0] => Array

    (

      [0] => 08001

      [SQLSTATE] => 08001

      [1] => 258

      [code] => 258

      [2] => [Microsoft][SQL Server Native Client 10.0]TCP Provider: Timeout error [258]. 

      [message] => [Microsoft][SQL Server Native Client 10.0]TCP Provider: Timeout error [258]. 

    )



  [1] => Array

    (

      [0] => HYT00

      [SQLSTATE] => HYT00

      [1] => 0

      [code] => 0

      [2] => [Microsoft][SQL Server Native Client 10.0]Login timeout expired

      [message] => [Microsoft][SQL Server Native Client 10.0]Login timeout expired

    )



  [2] => Array

    (

      [0] => 08001

      [SQLSTATE] => 08001

      [1] => 258

      [code] => 258

      [2] => [Microsoft][SQL Server Native Client 10.0]Unable to complete login process due to delay in prelogin response

      [message] => [Microsoft][SQL Server Native Client 10.0]Unable to complete login process due to delay in prelogin response

    )





)

I dont know where to include the database instace name for this connection to remote db as well.

Hope I was clear enough and someone can help me.

First time using SQL server at all so please bear the timidity :)

Thanks in advance,

Achala

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.