Closed crisleiria closed 5 years ago
Hi @crisleiria
Driver version 17.2 or higher is required for Ubuntu 18.04 support. Please double check the ODBC driver version. Also, can you provide a trace?
I am using 17.2 version, I will get you a trace log as soon as possible. But in teory it is possible to connect to SQL Server 2008 R2 with 17.2 driver correct?
Yes @crisleiria it is supported. Please check the system requirements
Dear Yitam,
Attached is the log file from my php application, we are using Laravel Framework. I have tried sql profile trace, but it is useless, no requests reach to SQL server.
I have 100% sure that username and password is OK, we have the same source code running from ubuntu 16.04 and not problems on that envirement (driver version is 13).
Another usefull information, I have used this script to install SQL server driver on ubuntu 18.04: https://github.com/laravel/homestead/issues/610#issuecomment-430679914
hi @crisleiria
The provided link to the comment does not work, but I did skim through the comments on their issue 610.
Please enable ODBC tracing in Ubuntu 18.04 and run sqlcmd again. That is the odbc trace log I was asking for.
Can you ping the server? Login timeout may mean that you can't communicate with the server.
You might also want to try isql
, like this:
isql -v -k 'Driver=ODBC Driver 17 for SQL Server;Server=<your server>;UID=<your user>;PWD=<your pass>'
Do make sure you escape special characters in the password. Yet, since you could connect from your Ubuntu 16.04 (assuming with the same credentials), I have ruled out this possibility.
Hi @yitam,
from isql comand I have this error:
[S1T00][unixODBC][Microsoft][ODBC Driver 17 for SQL Server]Login timeout expired [08001][unixODBC][Microsoft][ODBC Driver 17 for SQL Server]MAX_PROVS: Error Locating Server/Instance Specified [xFFFFFFFF]. [08001][unixODBC][Microsoft][ODBC Driver 17 for SQL Server]A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online. [ISQL]ERROR: Could not SQLDriverConnect
I have enable log trace, attached is the result from php website and from isql comand. odbctrace_isql.txt odbctrace.txt
I can ping sql server ip address with no problems, but it is a named instance (192.168.1.2\ABC2012). I do not have any problem on ubuntu 16.04, I dont thing this is the problem..
Thanks for the help.
@crisleiria for a named instance you will need to set it up, as explained in one of the questions in FAQ
This is the documentation for your reference.
Hope this helps.
Hi @yitam,
Thanks for the info, it is strange for me to setup named odbc on ubuntu 18.04.. I have nothing configured on 16.04 and I am able to connect... the only diference is the driver version...
Anyway I have setup DNS as instructions and still same error... Honestly I do not know what do to anymore...
This is a Vagrant virtual box machine.. maybe something on host machine?
@crisleiria please double check your settings. Some users are using named instance in Linux too, and #190 might be helpful.
I figured out... nothing related with ubuntu environment...
I review SQL server settings, TCP dynamic ports where enable, I have placed correct dinamic port assign and connected successfully. I will disable dynamic ports on SQL Server (I only have one instance running).
I dont need to setup DNS on ubuntu, if set tcp port on connection string.
Other conclusion on this: Ubuntu 18.04 is a virtual machine with a network bridge connection to the host. Ubuntu 16.04 is a real server on the same network of SQL Server.
From Ubuntu 18.04 I am only able to connect from dynamic port assign. From Ubuntu 16.04 I am able to connect without setting up port number.
@yitam Thank you so much for your support
Hi @crisleiria,
Could you please share how did you placed a port assign? I have exact same issue like this, I'm using ubuntu 18.04. I tried setting up the ports on firewall still not working.
Hi rosnaib11,
It was notting related with ubuntu environment, it was SQL Server setting. On my case, TCP dynamic ports was enabled on SQL Server settings.
You need to set this port to your SQL connection string. On my case I am using Laravel, I needed to setup port 49300 to my connection and thats it. If not, it will try to use default port setting (1433)
Hope this helps...
` 'sqlsrvconnection' => [
'driver' => 'sqlsrv',
'host' => env('PHC_HOST', 'localhost'),
'database' => env('PHC_DATABASE_PRODUCTION', 'forge'),
'username' => env('PHC_USERNAME', 'forge'),
'password' => env('PHC_PASSWORD', ''),
'charset' => 'utf8',
'prefix' => '',
'port' => 49300
],`
@crisleiria Thanks really helpful, I'm able to connect now.
Connection with telnet nor problem. But connection with PHP time out.
Hi @mhunesi
Which macOS are you using?
Have you tried using isql or sqlcmd to connect with your username and password?
I'm having the same error. Timeout.
Trying to connect using php7.3 on centos 7
hi @samuelhgf we won't be able to help without more details. Please create a new issue.
Hi rosnaib11,
It was notting related with ubuntu environment, it was SQL Server setting. On my case, TCP dynamic ports was enabled on SQL Server settings.
You need to set this port to your SQL connection string. On my case I am using Laravel, I needed to setup port 49300 to my connection and thats it. If not, it will try to use default port setting (1433)
Hope this helps...
` 'sqlsrvconnection' => [
'driver' => 'sqlsrv', 'host' => env('PHC_HOST', 'localhost'), 'database' => env('PHC_DATABASE_PRODUCTION', 'forge'), 'username' => env('PHC_USERNAME', 'forge'), 'password' => env('PHC_PASSWORD', ''), 'charset' => 'utf8', 'prefix' => '', 'port' => 49300
],`
It works for me! Thanks!! My port was different too
Failed to get DB handle: SQLSTATE[HYT00]: [Microsoft][ODBC Driver 17 for SQL Server]Login timeout expired i have same issuse i able to connect with this but in code connection having issuse
$dsn = "sqlsrv:Server=(xxxxxxxxxx,1433);Database=dbname;TraceOn=true;"; $databaseName="SBOLive_ROIPLKol"; $uid="user300821"; $pwd="pswdk2011";
$conn = new PDO($dsn, $uid, $pwd,array('MultipleActiveResultSets' => false));
} catch (PDOException $e) {
echo "Failed to get DB handle: " . $e->getMessage() . "\n";
exit;
}
@wasimpatel-g10 please create a new issue and fill out the details
I am unable to connect with SQL server 2008 R2 from ubuntu 18.04 and PHP 7.2 / 7.3 latest 17.2 driver.
Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : Login timeout expired.
With ubuntu 16.04, same SQL server I am able to connect... I am assuming is something with driver...
Anyone with same problem?