AWS Schema Conversion Tool to Connect to SQL Server on localhost - sql-server

Background
I have a SQL Server database on my machine, using mixed mode auth and SQL users setup on the database and mapped. When connecting via .NET app, I am able to use both windows auth and sql auth without issues. However when connecting via AWS Schema Migration tool, I am not able to connect.
Checks done:-
SQL Server Browser Service running
Port mapping left to default (1433)
TCP/IP pipeline enabled
Done both sql and windows auth
Instance name given via ##servername command as per SCT doc
Windows user given dbo and serveradmin permissions at global level
and also granted Login and DB engine connect
Ignoring the port no
Ignoring the instance name
Unable to check firewall as both SQL and tool running on same machine
Using same SCT config, I can connect to SQL Server elsewhere so drivers seem to be working.
Log message below
When only localhost provided
com.amazon.sct.dbloader.DbLoaderHandledException: Connection wasn't established. Check connection properties.
java.util.concurrent.ExecutionException: com.amazon.sct.dbloader.DbLoaderHandledException: Connection wasn't established. Check connection properties.
When name provided for machine and instance
Connection to 'jdbc:sqlserver://localhost\DESKTOP-N01JO12:1433' wasn't established. ERROR: code: 0; message: The TCP/IP connection to the host localhost, port 1433 has failed. Error: "Connection refused: connect. Verify the connection properties. Make sure that an instance of SQL Server is running on the host and accepting TCP/IP connections at the port. Make sure that TCP connections to the port are not blocked by a firewall.".
LOADER ERROR Error chain:
The TCP/IP connection to the host localhost, port 1433 has failed. Error: "Connection refused: connect. Verify the connection properties. Make sure that an instance of SQL Server is running on the host and accepting TCP/IP connections at the port. Make sure that TCP connections to the port are not blocked by a firewall."
Screenshots

For AWS SCT can access SQL server, the following conditions need to be satisfied:
DB has login account and user
User have to has admin role
SQL server authentication enabled
TCP/IP cho SQL server enabled
1. DB has login account and user
You can reference in this link:
https://www.guru99.com/sql-server-create-user.html
2. User have to has admin role
You can reference in this link: https://tableplus.com/blog/2018/10/how-to-create-user-with-admin-access-in-sql-server.html
3. SQL server authentication enabled
You can reference in this link:
SqlServer: Login failed for user
Note: Remember to restart SQL server
4. TCP/IP cho SQL server enabled
You can reference in this link: https://www.youtube.com/watch?v=p9mv2RP6Tck
==> Conclusion
I see you do all the think above
Here is my connection information for SQL server on my EC2 windows server
(I can't embed picture because I don't have enough reputation point)
Perhaps you should write connection information like me
Hope this help!

Related

Connection to SQL Server from Airbyte failing: Cannot Create PoolableConnectionFactory

I have standalone SQL Server 2019 Developer Edition installed on my machine. I am able to use pymssql to connect to it and write data in. Using this method to connect:
conn = pymssql.connect(
host='my_host',
user="airbyte_reader",
port = 1433,
password = '******',
database = "my_db")
#arranged like this for Stack's readability, not to infuriate people.
Then my Airbyte container is running on the same machine and I can see the UI on my localhost:8000. When I try to create a SQL Server source it requires
Database
Host
Password
Port
Username
I've confirmed in SQL Server Configuration Manager that TCP/IP is enabled, and that dynamic port allocation is off, and that the static port is set to 1433. Using a user login I created I'm able to login through SQL Server Management Studio. However, when I provide Airbyte that same user, password, port, host, and database. It gives me this error message when connecting:
Could not connect with provided configuration. Error: Cannot create
PoolableConnectionFactory (The TCP/IP connection to the host
my_host, port 1433 has failed. Error: "my_host. Verify the
connection properties. Make sure that an instance of SQL Server is
running on the host and accepting TCP/IP connections at the port. Make
sure that TCP connections to the port are not blocked by a
firewall.".)
Not sure what else I can troubleshoot here, but according to the symptoms above anyone know what's going on?
(Also this is just for testing out Airbyte this isn't an actual architecture or solution)
With help from #AlwaysLearning
If you have this issue, first make sure you're using a user that can authenticate via SQL Server Authentication.
Then from SQL Server Configuration Manager get the IPv4 address and use that in the field for "host" in the airbyte UI.

How to connect to Azure SQL Database through a VM jump host using DBEaver?

What I have:
Azure SQL Database on private virtual network
Jump host - Whitelisted Azure VM that can connect to the Azure SQL Database
Local machine --PuTTY--> Jump Host --sqlcmd--> Azure SQL DB
What I want to do:
Usually I PuTTY into the VM and use sqlcmd to operate, but the GUI is difficult to view when query a lot of data. So I want to use DBEaver on my local machine to access the Azure SQL Database.
Config used:
In Connection setting -> Main: Azure SQL Database (same server host, port, database, username, and password as usually used in sqlcmd)
In Connection setting -> SSH: Jump host
In Connection setting -> Main -> Edit Driver Settings -> Libraries: jdbc 9.4.1.jre8 and jdbc_auth 9.4.1.x64
Problem I face:
I tried to use ssh tunnel configuration to connect. In image 1, when I click "Test tunnel configuration", it can successfully connect to the whitelisted VM.
a) In image 2 main config, I tried to use hostname in host and click "Test connection". It failed with error message
Cannot open server "127.0.0.1" requested by the login. The login failed.
b) In image 2 main config, I changed hostname as server IP (using ping <hostname> in jump host) and retry. It failed with error message
Cannot open server "127.0.0.1" requested by the login. The login failed.
c) In image 2 main config, I tried to use random IP address in host and click "Test connection". It failed with error message
The TCP/IP connection to the host 127.0.0.1, port 45851 has failed. Error: "The driver received an unexpected pre-login response. Verify the connection properties and check that an instance of SQL Server is running on the host and accepting TCP/IP connections at the port. This driver can be used only with SQL Server 2005 or later.".
What am I missing?
dbeaver ssh tunnel config
dbeaver main config
We have got the same issue.
Azure SQL Database needs to know the instance name associated to your username. Since you are using an ssh tunnel on 127.0.0.1, Azure can't know the name of the instance. You need to add the database name to your sql login (not the one used for the jumpbox, but the one used to connect to the db):
username#database_name.database.windows.net
Instead of
username

Connecting to Azure DB from SQL management studio is failing MSSQLSERVER_10060

I'm trying to connect to the sql server that has been created on Azure using SQL management studio, but i'm getting the following error.
Error message: An error has occurred while establishing a connection to the server. When connecting to SQL Server, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: TCP Provider, error: 0 - 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 SQL Server, Error: 10060)
I have enabled the client IP in the SQL server firewall settings.
Please let me know if anything else need to be taken cared. Thank you
To resolve this error, try one of the following actions:
Make sure that you have configured the firewall on the computer to allow this instance of SQL Server to accept connections. That is, If you are trying to connect from within a corporate network, outbound traffic over port 1433 may not be allowed by your network's firewall. If so, you cannot connect to your Azure SQL Database server unless your IT department opens port 1433. On the Azure Side, you also need to check if the NSG (associated with that subnet the Azure SQL server sitting in) allows the client IP with the specific port 1433.
Add the client IP in the SQL server firewall settings if you enable a server-level firewall.
Telnet the current IP of your Azure SQL Database server with the port to verify the network connection.
Ensure the server name you are connecting to is correct.
Check that your own firewall allows your connection across the internet to the instance.
Typically if it was the Azure firewall side, it would prompt you to add your IP to the firewall rules, provided you're connecting with an admin account.
This cause by network restriction in your lan. you can try by switching your network connnection. It worked for me.

SQL Server Named Instance TCPIP port settings & EndPoints/Infrastructure permissions error

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

SQL Server: error when connecting

The application I'm using tries to connect SQL Server named instance running on a dedicated database server. Here's the error I'm getting:
The TCP/IP connection to the host <instance_name>, port 1433 has failed. Error: Connection refused: connect.
Is the firewall blocking my access or what? Should I dedicate a different port for this application?
The error refused connect implies that your connection does not have permissions to connect to this instance of SQL Server.
Are you using Windows Authentication or a SQL Server Login?
For troubleshooting guidelines see: Troubleshooting Server and Database Connection Problems

Resources