I have a big problem connecting my php page which is running on the same PC as my SQL Server with the SQL server and execute things...
Maybe this following warning will help you:
Warning: odbc_connect(): SQL error: [Microsoft][SQL Server Native Client 11.0]Named Pipes Provider: Could not open a connection to SQL Server [53]. , SQL state 08001 in SQLConnect in MY_CONFIG_FILE on line 9
I wonder what causes this problem as the webserver with the php page is running on the same machine as my SQL server does.
I´m using this code:
odbc_connect("Driver={SQL Server Native Client 11.0};Server='MY_IP';Database='MY_DATABASE';", 'MY_SQL_USER', 'THE_PW_OF_MY_SQL_USER');
What I have tried so far:
Adding the IP to the host file of Windows
Switching the complete firewall off
adding a User-DSN ODBC Connection called SQLEXPRESS with a working connectivity test
Connecting from my home PC with SQL Management Studio to the SQL Server. It worked with the same login data and IP which I´ve added in the SQL Config File.
Enabling TCP/IP and Named Pipes in the SQL Management Studio on port 1433
Restarting everything several times (Professional Solution, I know ;))
enabling TCP/IP and Named Pipes in the cliconfg.exe
I hope there are some gurus here which can help me :)
Thx a lot in advance ;)
I´m sorry for the troubles.
The problem was, that I was using SQL Server Native Client 11.0 as driver.
I switched it to SQL Server and now it works :/
Hopefully this at least helps someone, being in a similar problem....
Related
When the application tried to connect to the SQL Server database, it returns this error [Microsoft][ODBC Driver 17 for SQL Server]SSL Provider: [error:141A318A:SSL routines:tls_process_ske_dhe:dh key too small]. The application uses Laravel as the framework and ODBC 17 to connect to the SQL Server database.
For context, since this seems like an SSL problem, the app is trying to connect to a database in a different server, and the application is connecting from a local domain. The server is using Centos 8 as the OS and uses OpenSSL. I have tried searching in the internet but what I found was answers to configure the OpenSSL ciphers, I do not know if that is a safe option.
Please if anyone has solved a problem like this, I need your help, thank you beforehand.
**Note: If further information regarding the conditions are needed please inform me.*
A colleague of mine helped me find an unusual fix for this problem, FYI this is not the proper way to fix this problem in production otherwise.
The application that I had to deploy apparently was connecting to a legacy database (Even though the database was a SQL Server 2016) and the crypto policies was not letting the application connect to the database. The dh key on the database was the one that is too small so we ran this and voila! The application is running.
sudo update-crypto-policies --set LEGACY
This command allows 1024 bit dh-keys to be allowed.
Don't try this, I am using this in a development environment, please migrate your database to something safer.
This was our source:
https://yoku0825.blogspot.com/2019/12/centos-80url-error141a318assl.html
I'm moving some php sites backed by SQL from a 2003 server to a 2012R2 server. I haven't had time to update code to use a newer php version so am using 5.2.10. I have everything working except I can't get a connection to the SQL server - the latter has not changed.
The errors I'm getting are:
PHP Warning: mssql_connect() [function.mssql-connect]: Unable to connect to server...
PHP Warning: mssql_select_db(): supplied argument is not a valid MS SQL-Link resource in...
How can I verify that mssql_connect and mssql_select_db are working? Or do those errors mean that they are? The credentials are the same as those on the currently working server to be replaced so I'm fairly certain that's not it but if I can be assured that the php side is working, I'll invest my attentions back to SQL and/or a possible network issue (although they're on the same network behind a firewall so that shouldn't be it)
I'm stuck with what to do next.
i was wondering if anyone knows why i am getting the following error.
I have an application doing massive queries to a SQL 2008 Server. The main application runs over PHP on linux , I call many php scripts simultanously to a windows server running PHP over xampp, this server queries the sql database and this is where I am getting the error.
On this windows server I hava PHP 5.4.4 with the sqlsrv extension. I have the sql server configured to handle unlimited connections. however when I send many API calls (thousands) i eventually start getting connection errors like the one below,
Unable to connect to server
I read that mssql conection can be tuned with the max_procs config, however I am using sqlsrv extension instead and I havent found any info regarding this .
Has anyone experienced this issue before.
Thanks in advanced.
I have used default MS SQL driver to connect to a SQL server in a php application.
I'm using XAMPP 1.6.8. my php version is 5.2.6.
Application was connected successfully to the SQL server and the application was running successfully for a long time. Now suddenly the application is showing an error on mssql_connect() function with same MS SQL access information.
the error is "Unable to connect to server: xxx.xxx.xxx.xxx"
I also checked the SQL server access info with a SQL client. SQL client can connect successfully, therefore i think the access info is correct.
Can any one help me resolved this issue?
Thx
I just found my solution here. http://jimmyli.net/2009/03/php-unable-to-connect-to-mssql/ .problem was that the file ntwdblib.dll packaged with PHP5 was an old version. then i just replace with updated one from here http://jimmyli.net/wp/wp-content/uploads/2009/03/ntwdblib.zip
Thx
Most of the time it works fine. Sometimes I refresh the screen once and it works and sometime I have to wait a few minutes. I have also gotten up and tried it on a different pc and it appears that if it is not working on one computer it is not working any where.
The program opens the databases in the same order each time and the error has occurred on both the first and the second database.
I have not seen a pattern.
I am using godaddy.com shared hosting.
PHP Version 5.2.17
PDO Driver for MySQL, client library version 5.0.77
Any advice would be appreciated.
If you're connecting via TCP sockets, this could be due to an intermittent DNS lookup failure. e.g. your connection string uses 'mysql.example.com:3306', and whatever DNS server(s) your host is configured to use fails for whatever reason.