Im setting up a Ubuntu server in my office which is going to be used for automatic reporting. Ive set it up with the LAMP stack. Ubuntu 16.04 server edition.
Im getting an error when Im trying to connect to one of my companies MsSQL servers through PHP on my new server:
Failed to get DB handle: SQLSTATE[HY000] Unable to connect: Adaptive Server is unavailable or does not exist (severity 9)
Ive set up my connection with the default port for MsSQL which is 1433. However its not working.
I have READ rights to this SQL Database.
Are there any ways to find out what PORT the SQL server is listening on? Without contacting the IT Dept. (they are on vacation)?
nmap is a great port scanner.
sudo at-get install nmap
nmap -p- 192.168.1.1
If your target is not 192.168.1.1 you should change the IP.
Read this.
Looks like it is because of misconfiguration of SQL Server. Following steps are required to gain remote access to SQL Server:
Enable TCP/IP access for SQL Server: Start -> All programs -> Microsoft SQL Server YourVersion -> Configuration Tools -> SQL Server YourVersion Configuration Manager -> SQL Native Client Configuration -> TCP/IP -> right click -> enable.
Add Inbound rule for Windows Firewall allowing access for 1433 port from required network (or hosts).
Enable authentication for both SQL Server and Windows modes. In SSMS, right click on connected instance -> Security -> Server authentication -> SQL Server and Windows authentication.
Make sure your login (Security -> Logins -> YourLogin) have all required rights.
With all this information, you have to contact your SQL Server DBA and ask him to check out configuration.
Related
I have a SQL Server version 12.0 instance installed on a Windows Server 2012R2 (SERVER/SQL), and a SQL Server Express version 11.0 instance installed on a windows 10 workstation (WIN10/SQLEXPRESS). Both are on the same domain. I am logged in as the domain admin and have full rights on both SQL instances.
On my WIN10 machine I am able to create a linked server from (WIN10/SQLEXPRESS) to (SERVER/SQL).
On my SERVER when I attempt to create a linked server from (SERVER/SQL) to (WIN10/SQLEXPRESS) I am told to ensure that the instance will allow for remote connections. I have gone through about 40 hours of troubleshooting this, ensuring that all firewalls, ports, security and agents and browsers are open.
Is there any reason I cannot link a SQL Server Express to another SQL Server, but can the other way around?
I would like to be able to call stored procedures from my main SQL Server but am not able to.
Please note, the purpose for the SQLEXPRESS on the WIN10 machine is due to the vendor requirements for the software I am using. Otherwise I would have the instance on my SERVER.
Almost certianly a network issue.
Using SQL Server Configuration Manager configure SQLEXPRESS to enable TCP/IP and listen on a fixed port, preferably 1433 if no other instance is on the server. Restart the instance.
Create a Windows Firewall rule enable inbound TCP/IP connections to the port.
Test network connectivity to the target port from the other server with powershell, eg:
PS C:\> test-netconnection WIN10 -Port 1433
Test SQL connectivity with SQLCMD or SSMS on the server to the WIN10 box.
Create the linked server.
I have 2 PC's on my at-home network and when I use this Microsoft connect utility trick to test database connection, I can connect to the database in SQL Server Express on the PC that SQL Server Express is installed on with no problem.
But when I using the same utility trick on the other PC and try to test the same database connection, I get an error
Test connection failed because of an error in initializing provider. [DBNETLIB][ConnectionOpen server does not exist or access denied
I have Norton Security Suite on the PC where SQL Server Express is installed on, and added a rule to open port 1433 and even disabled "Smart Firewall" and get the same error. I even added a DB user (Used in .UDL utility shown below) with all rights, same error. Any ideas on a way to fix this?
By default SQL Express doesn't have TCP/IP enabled, and by default listens on a dynamic port when it is enabled. You can use SQL Server Configuration Manager to both enable TCP/IP and disable dynamic ports and configure SQL Server to listen on port 1433.
And once you do you can connect with just the hostname. No port number or \SQLEXPRESS required.
I have a local installed SQL Server 2016 (Developer edition) installation on Windows 10 Pro. There is one named instance. I am a developer using MS SQL Management Studio and JetBrains DataGrip.
I just want my connections within my local machine to work with SQL Server over TCPIP using a SQL Server user account..! At the moment this only works using my Windows Authentication mapped to ServerAdmin
Named instance
RAXLENOVOT560\MSSQL2016MAIN
(authentication is mixed mode)
There are 3 issues that maybe linked:
TCP Port number does not appear to take effect within the Sql Server Configuration Manager.
The Sql Server Configuration Manager only shows limited properties on the Client Protocols/TCPIP settings. (please see screen shots)
Sql Server login user account does not connect via TCP due to an error. Login within local machine, local development from DataGrip to SQL Server.
1. TCP Port number
I have set this to 65321. However when I try and connect using this port no connection is made.
When I checked using the following SQL query I see the port number is actually 65514
SELECT DISTINCT
local_tcp_port
FROM sys.dm_exec_connections
WHERE local_tcp_port IS NOT NULL
results
local_tcp_port
--------------
65514
I change the port number in the config tool, restart ALL SQL Server services, reboot and still nothing works. Still listening on port 65514
Note I did not choose 65514, this seems to be a default from SQL Server.
2. The Sql Server Configuration Manager Properties Missing
Note the properties screen is limited only to a few options, there are usually lots more why is is? Perhaps due to running on Windows 10 Pro vs Windows Server?
3. Connection Login failure
Login from the local machine only.
I have opened the firewall for all the relevant SQL Server ports
TCP 1433
TCP 65514 (the forced sql server port)
TCP 65123 (what I would like to use)
UDP 1434 Sql Server Browser
I attempted login via a number of means
Sql Server Management Studio
Udl File
Java connection via DataGrip
Since opening the firewall, all the connections work but only if the hostname is 127.0.0.1, why can't I use the computer name? The connections also work if I use my Windows Login but NOT a SQL Server login
The login fails due to the error shown below from the SQL Server Log (which proves the TCPIP connection is reaching SQL Server).
Login-based server access validation failed with an infrastructure error. Login lacks connect endpoint permission
Date 24/04/2018 11:25:05
Log SQL Server (Current - 24/04/2018 11:20:00)
Source Logon
Message
Login failed for user 'SvrDeveloper'. Reason: Login-based server access validation failed with an infrastructure error. Login lacks connect endpoint permission. [CLIENT: 127.0.0.1]
The Sql Server User has the following permissions and settings (please see screenshot)
Name = SvrDeveloper
Server Roles = public
Securables = RAXLENOVOT560\MSSQL2016MAIN Type=Server
Securables = TSQL Default TCP Type=EndPoint
Connections
Udl Connection
[oledb]
; Everything after this line is an OLE DB initstring
Provider=SQLNCLI11.1;Integrated Security=SSPI;Persist Security Info=True;User ID="SvrAdmin";Password="Password123";Initial Catalog="";Data Source=TCP:127.0.01\MSSQL2016MAIN,65514;Network Library=DBMSSOCN;Initial File Name="";Server SPN=""
Java connection:
jdbc:sqlserver://127.0.0.1:65514;databaseName=CcTools;user=SvrDeveloper; password=Password123
Some additional information:
Version
I am trying to connect to my local SQL DB through AnyLogic 7.3.6. I have SQL Server 2016 Developer installed and the DB is in mixed authentication (Windows & SQL). When adding the connection it gives the following error:
Network error IOException: Connection refused: connect
Connection refused: connect
My host is called localhost. I have tried leaving Login and Password blank, hoping for Windows Authentication, and I've tried adding a SQL user (Test, test) to the server, both to the same result. I am using the com.microsoft.sqlserver.jdbc.SQL.ServerDriver JDBC driver, but have also tried net.sourceforge.jtds.jdbc.Driver (same result).
Can anyone explain how I can make a connection between AnyLogic 7 and SQL Server 2016 (Developer)?
I don't think the Windows Authentication will work with AnyLogic. So make sure to have a correct configured SQL User to use.
Make sure that "Allow remote connections to this server" is enabled. Open SQL Server Management Studio -> Right click on your instance -> Properties -> Connections.
Check so TCP/IP connections are enabled. Open SQL Server Configuration Manager -> SQL Server Network Confinguration -> Select your instance -> Enable TCP/IP. It's also possible to change the default port here.
The TCP/IP connection is using port 1433 as default. Make sure to allow connections through this port in your firewall.
I am trying to connect to MS SQL Server hosted on a network. Windows authentication and SQL Server mode is enabled (both). I cannot connect
[DBNETLIB]SQL Server does not exist or access denied.
[DBNETLIB]ConnectionOpen (Connect()).
Can anybody suggest how to provide the server name when there exists a domain and please be explicit with slashes if any.
Assuming your client is on the same network and all of the DNS records are working correctly (try pinging the server to see if it's available).
You could try connecting using the IP address
If you are trying to connect to a named instance use server\instance
Check that you are not being blocked by the Windows Firewall on either your machine or the server (at the very least port 1433 will need to be open for a default SQL instance)
make sure you enabled the following in Configuration Manager :
SQL Server Network Configuration
- Protocols
--- TCP/IP - Enabled
SQL Server Network Configuration (32bit and 64bit)
- TCP/IP - Enabled
- Name Pipes - Enabled
and make sure SQL Server Instance is logged on as a domain account for you to be able to execute network backup.
try opening sql thru SSMS if named instance use IP/name of instance
else just the IP
and log in as "sa"