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.
Related
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
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.
I am trying to allow remote connections for SQL Server Express. When I connect from machine A to connect to SQL Server on machine B using Visual Studio, I get an error:
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections
I followed the following steps below which did not help.
Enable remote connections on the instance of SQL Server that you want to connect to from a remote computer. Turn on the SQL Server Browser service. Configure the firewall to allow network traffic that is related to SQL Server and to the SQL Server Browser service.
In fact I tried by turning off firewalls entirely but no luck. Any suggestions ?
You need to open the SQL Server Configuration Manager and enable TCP/IP. This is not enabled by default. Port 1433 will need to be open for remote connections.
SQL Server Configuration Manager
SQL Server Network Configuration
Protocols for $InstanceName
Right hand pane select TCP/IP and enable
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"