unable to connect ms sql server from azure app - azure

I have Azure app and SQL Database.SQL URL like jdbc:sqlserver://xxxxx.database.windows.net:1433;databaseName=xxxxx that one try connect my local tomcat,its successfully connected.but when try connected from Azure app,I am getting exception
[org.jboss.jca.core.connectionmanager.pool.strategy.OnePool] (JCA PoolFiller) IJ000610: Unable to fill pool: java:jboss/DB/DS: javax.resource.ResourceException: IJ031084: Unable to create connection
at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.createLocalManagedConnection(LocalManagedConnectionFactory.java:345)
at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.getLocalManagedConnection(LocalManagedConnectionFactory.java:352)
at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.createManagedConnection(LocalManagedConnectionFactory.java:287)
at org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreConcurrentLinkedDequeManagedConnectionPool.createConnectionEventListener(SemaphoreConcurrentLinkedDequeManagedConnectionPool.java:1320)
at org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreConcurrentLinkedDequeManagedConnectionPool.fillTo(SemaphoreConcurrentLinkedDequeManagedConnectionPool.java:1136)
at org.jboss.jca.core.connectionmanager.pool.mcp.PoolFiller.run(PoolFiller.java:97)
at java.lang.Thread.run(Thread.java:748)
Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Cannot open server "App-server" requested by the login. The login failed.

but i can't use from azure app server (VM) from sql Database
Do you mean you application hosting on Azure VM?
If I understand it correctly, you should add Azure VM's public IP address to sql server firewall.
Via Azure portal to add VM's IP address:
Also you should add port 1433 to VM's NSG inbound rules and OS firewall settings.

Please make sure you have set On the "Allow access to Azure services" setting on Azure portal for the Azure SQL database or its logical server. Please see below image.
You need to also specify the user#database on the connection string. Please read here for more details on how to build the connection string.

Related

Why my azure vm not able to connect to azure database?

I have a vm in azure. And I have a database as well.
I can remolty connect the azure databae from SQLMS, But When I Try to connect from my azure VM. I get A netwrok or related instance while establishing connection to the databse ?
Here is my outbond rules
Any reason ?
Check you settings for the Database Firewall, maybe it is close for your vNET, and check the NSG Rules applied to the VM. In the VM you can check connections with this:
Connection Troubleshooting for VM

Connect to Azure SQL in another subscription

I have an application running in Azure Batch which tries to connect to our customer's SQL Server also running in Azure. The connection fails, because the customer has default firewall on the SQL Server and the IP address of the Azure Batch node is not allowed in the firewall rules.
When I try to connect from the Azure Batch application to out SQL Server running in another subscription, the connection is successful.
Why in the first case the connection does not work and in the second case it works?
Is it possible to connect to the customer's SQL Server? I cannot give them an IP address to allow in the firewall, because the IP address of the Azure Batch is dynamic.
The solution is to set this switch to Yes in SQL Server → Security → Firewalls and virtual networks. With this setting, it is possible to connect from Azure Batch application to SQL in another subscription.

I can't seem to connect to my Azure Database for MySQL server from my Azure Linux VM

I have a Linux Virtual Machine (Debian 9) deployed in Azure with Service Endpoints for Sql enabled and properly added -if I navigate the portal towards the VNet and enter the Service Endpoints tab, I can clearly see the Sql Service Endpoint listed. Just FYI, the reason for the Service Endpoint is that the VM has a dynamic IP, so I can't just whitelist it in the DB resource's configuration.
On the other hand, I have an 'Azure Database for MySQL server' deployed in the same resource group, same location and whatnot, but I can't seem to connect to it.
The steps I take when I try to connect are as follow:
I connect to the VM through SSH.
In my VM I have mysql-server installed
I write mysql --host <fully qualified server name> --user <server admin login name>#<server name> -p
I get the following error: "ERROR 9002 (28000): Server is not ready for incoming connections."
I've been reading the documentation and searching in forums for a reason why this might be happening, but I simply cannot seem to make it work. I have tried changing the status of the "Allow access to Azure services" option in the Connection security tab of the DB resource, but it doesn't seem to matter.
Could anyone have any idea of how I might go about solving this??
You said you enabled the SQL endpoint on the virtual network, but did you add a VNET rule to the instance (Attach an existing VNET)? You can find this in Azure Database for MySQL server -> Connection Security -> VNET Rules -> Attach existing VNET.
If you can't see your VNET listed then there is a mismatch between the regions of your SQL server and your VNET: They must be deployed to the same one. Additionally check that you have a General Purpose or Memory Optimized server, this feature is not available in Basic tier.
If all of this is in place, try enabling Diagnostics on the SQL Server, try logging in again a few times, then view the log file and post anything strange.

After Azure WebApp integration to VNET - Unable to connect to Azure SQL

I was trying to connect my Azure webapp(paas) to my VM in another VNET - I could get this working by doing a VNET integration following the instructions https://learn.microsoft.com/en-us/azure/app-service/web-sites-integrate-with-vnet
I could now connect to the VMs in the destination VNET however the Webapp is now unable to connect with the Azure SQL(PaaS) . Is it not that webapp should continue to access the PaaS resources as before or do I need to update any configuration to get this connectivity.
Edit: I was able to get this working with a VPN(Route based) and with a VPN GW and P2S connection.
However for some reason I do not get this working with my existing VPN which is also a route based but has a Azure SSL VPN SSTP. Can this cause some connection issue to Azure SQL ?
Appreciate your response
PS: I do not want to use ASE specifically as the need is very limited and cost for going to ASE is high for this use case.

Azure WebSites using new Virtual Network Integration features failed to connect to SQL Server in VM machine

I tried to configure a VPN with default values (10.0.1.x) with a point-to-site feature configured.
Azure Websites has been configured too, using the new Azure portal, to point to the Point-to-Site of the VPN.
When a try to contact SQL server of my VM in Azure (Iaas) fails, while locally on the VM I can do it.
I also configured an end point for the port 1433 on the VM with the relative firewall configuration.
Is there a way to check where is the issue using the website ?
Thanks a lot.
Fabio

Resources