I am trying to connect AWS Glue to an Azure SQL Server via JDBC. I have tried different settings for the jdbc url without success. The URL's look as follows:
jdbc:sqlserver://domain.windows.net:1433/database
jdbc:sqlserver://domain.windows.net:1433;databaseName=database
In the documentation of AWS the SQL Server syntax is jdbc:sqlserver://host:port;databaseName=db_name
For test purposes I have used Squirrel SQL and made a succesful connection to my Azure SQL Server with it.
When I try to make a test connection within AWS Glue AWS CloudWatch gives me following log:
Attempting to connect with SSL: jdbc:sqlserver://domain.windows.net:1433;database={database}
SSL connection to data store failed. Retrying without SSL.
Check that your connection definition references your JDBC database with correct URL syntax, username, and password. The TCP/IP connection to the host domain.windows.net, port 1433 has failed. Error: "Connection timed out: no further information. 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.".
What seems strange for me are the '{' brackets in the connection. Azure's Connection String tells me, that the connection itself should look like:
jdbc:sqlserver://domain.windows.net:1433;database=database
Maybe this is the issue but I am not sure how to solve it.
As you could connect successfully to Azure SQL from squirrel; things are good on Azure end.
One issue can be SSL; But most probably it is not because it is retrying without SSL also which also failed.
On Glue end; please see if you have outbound connections allowed on that port.
you have to set outbound and inbound rule of security group which you have defined during JDBC connection. set outbound rule to all trafic allowed. also allowed tcp traffic in your azure database.
Related
Kubernets deployment of application on AWS is giving following error while connecting to a SQL Server RDS instance
org.apache.naming.NamingContext.lookup Unexpected exception resolving reference
com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP connection to the host , port 1433 has failed. Error: "connect timed out. 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.
Tried enabling all the traffic in the security group inbound rule also the ec2 instance VPC and RDS VPC has peer connection link, not sure what is the issue causing this error
I found the root cause for this issue, if someone like me stuble upon this question/issue in future then the issue was due to the Route not having the EC2 instance VPC's entries.
I am trying to connect my RDS instance to a Jmeter load test however no matter what I try, I keep getting this error message in the Results Tree:
Cannot create PoolableConnectionFactory (The connection to the host database-1.cqdkrfikhe1t.us-east-1.rds.amazonaws.com, named instance database-1 failed. Error: "java.net.SocketTimeoutException: Receive timed out". Verify the server and instance names and check that no firewall is blocking UDP traffic to port 1434. For SQL Server 2005 or later, verify that the SQL Server Browser Service is running on the host.)
I feel it may be a problem with my Database URL in JDBC Connection Configuration.
The picture below shows the summary report.
I have mainly tried rewriting the Database URL multiple different ways but none of them seem to work. I have also tried removing and reinstalling the JDBC Drivers but that doesn't seem to work either. I have absolutely no idea what the problem could be. Could someone please help me out with this problem?
Edit: When I change the Database URL I sometimes get this error
message as well:
Cannot create PoolableConnectionFactory (The driver could not establish a secure connection to SQL Server by using Secure Sockets
Layer (SSL) encryption. Error: "PKIX path building failed:
sun.security.provider.certpath.SunCertPathBuilderException: unable to
find valid certification path to requested target".
ClientConnectionId:9b700d73-f3f0-4cf6-b3a4-607fa9827219)
I think you need to use port 1433
Check out Connecting to a DB instance running the Microsoft SQL Server database engine article
So cross check the port number, VPC options, public accessibility, etc. with the values from the JDBC Connection Configuration
More information: The Real Secret to Building a Database Test Plan With JMeter
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!
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.
I am having an issue connecting to my SQL Server Database remotely from another computer.
I am trying to connect to the database using a VB.Net application that is suppose to be able to interact with it. I'd say my connection string may be the issue, but I have no problem connecting on the machine the database is on using the connection string.
This is what the connection string looks like though:
"Data Source=[IP_ADDRESS],[PORT];Network Library=DBMSSOCN;Initial Catalog=SQL_Database;Persist Security Info=True;User ID=[USER];Password=[PASS]"
The error I am getting right now is:
Database 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. (provider: TCP Provider. error: 0 - The wait operation timed out.).
This is what I have done so far to try to get this to work:
I have made sure that the files being run are on not a network/shared drive.
I've added an exception for TCP Port 1433 and UDP Port 1434 as Incoming Rules to the Firewall.
I've tried disabling the firewall.
I have gone into SQL Server Configuration Manager to ensured that the TCP settings are setup properly.
One thing I am not sure about, is that in the Configuration Manager, I have both the SQL Server and SQL Server Browser running, but the SQL Server Agent is unable to start. Would this cause me my problem?
If not, what else could be my issue? I need to be able to access this database remotely, but the connection string seems to only work locally.
So the issue was literally my company's installed network Firewall. Apparently when I asked if the firewall had been put down for me to test this, "Yes" really meant "No". Once I got the firewall temporarily disabled I was able to connect to everything perfectly fine.