3

I can easily access Azure SQL database through SQL Server 2014 but When I am trying to connect my PHP(Laravel) web application to Azure SQL Server through ODBC Driver 11 for SQL Server and also tried with SQL Native Client 11 , it is giving me different types of exceptions as given below

  • [Microsoft][ODBC Driver 11 for SQL Server] A transport-level error has occurred when receiving results from the server (provider: TCP Provider, error: 0 - The semaphore timeout period has expired.)
  • [Microsoft][ODBC Driver 11 for SQL Server] A transport-level error has occurred when receiving results from the server. (Provider: TCP Provider, error: 0 - An existing connection was forcibly closed by the remote host.)
  • [Microsoft][ODBC Driver 11 for SQL Server]System.Data.SqlClient.SqlException: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding. The statement has been terminated.
  • [Microsoft][ODBC Driver 11 for SQL Server] A connection attempt
    failed because the connected party did not properly respond after a
    period of time, or established connection failed because connected
    host has failed to respond.
  • [Microsoft][ODBC Driver 11 for SQL Server]Named Pipes Provider: Could not open a connection to SQL Server [53]. , SQL state 08001 in SQLConnect

I have gone through this Technet Article and followed all the steps successfully till step 3.

But when I traceroute to the server it is giving me following result

traceroute result

So, the issue which I am facing is due to reason that I am getting request timeout. And I have configured server firewall and added the client ip.

meet-bhagdev
  • 2,608
  • 18
  • 22
kapilpatwa93
  • 4,111
  • 2
  • 13
  • 22
  • Seems like you are experiencing connection failures. Do you have retry logic built into your application? Do you face the same error when you connect through another client driver/SSMS? – meet-bhagdev Mar 07 '16 at 04:31
  • @KapilFQ, Could you please try to follow these tutorials:https://azure.microsoft.com/en-us/documentation/articles/sql-database-develop-php-simple-windows/ and use SQLSRV extension (https://www.microsoft.com/en-us/download/details.aspx?id=20098)? – Will Shao - MSFT Mar 08 '16 at 06:56
  • @WillShao-MSFT I tried this also but still I got same error. Yesterday I took backup from azure sql server and restored it in local sql server and connected to my laravel project by creating ODBC connection and this time I could access the database. I really dont understand why I am facing problem while accesing the database from azure – kapilpatwa93 Mar 09 '16 at 11:00

3 Answers3

0

I think you can reference the article A transport-level error has occurred when receiving results from the server. People got the same error.

The possible solution is

1) Check the provider of that linked server.

2) Enable "Allow inprocess" option for that particular provider to fix the issue in provider properties.

3) For 'Packet Size=xxxxx' in connection string, try to make that 'xxxxx' shorter.

4) Try to disable "IP Offloading" on the network interfaces.

5) Restart Virsual Stdio.

6) Stopped the IIS Express and rerun your application.

Hope this can be helpful.

Community
  • 1
  • 1
Alex Chen-WX
  • 521
  • 2
  • 5
0

I have a quick test leveraging odbc_connect like:

odbc_connect("Driver={SQL Server Native Client 11.0};Server=tcp:<sqlsrv_name>.database.windows.net,1433;Database=<database>;Uid=<user>@<sqlsrv_name>;Pwd=<password>;Encrypt=yes;Connection Timeout=30;", "<user>@<sqlsrv_name>", "<password>");

However I cannot reproduce your issue. Could you please create a new Azure SQL Server, and try to connect to this new one from your local script?

If you still occur this issue, there are may be something problem with your local environment. You may check your network as your logs have shown a timeout exception.

Gary Liu
  • 13,758
  • 1
  • 17
  • 32
0

Resolved this issue.

Problem was with the plan which I selected,it wasn't sufficient for my need.

I selected plan with higher configurations and fortunately it worked.

kapilpatwa93
  • 4,111
  • 2
  • 13
  • 22