MySQL connection in Logic app required an on premise gateway by default - why? - mysql

I have an azure hosted MySQL data base and am now trying to use the MySQL connector in a logic app. Unfortunately the connector requires an on premise gateway as one of the mandatory requirements. I have read that I should disable SSL which is already the case. Any idea how I can make a connection to this DB?

MySql connector in logic app at this point allows you to connect to the on premises mysql database through an on premises datagateway. You cannot directly connect to the mysql database hosted on azure. The workaround for this is that you write an azure function which connects with the mysql databases and call the azure function in your logic app. The azure function can be a http triggered

Related

Connecting from google cloud run to google cloud (mysql) using .net core

I have a .net core app installed as a docker on google cloud run, this app that needs to be connected to cloud sql (mysql).
When using the private ip address it, it's not working.
When using public IP, it's working, but It's not a good solution for production.
this is my connection string:
"ConnectionString": "server=10.4.16.6;database=mydb;user=root;pwd=mypwd"
When I create the app, Im able to select the database i need to connect to:
But this is not helping to connect.
The relevant docs are explaining how to do it for python and java explictly.
If you do not want to use public IP then you would need to rely on service account to connect to Cloud SQL. However, .net MySQL driver has no understanding of GCP IAM and Service accounts. So you will need to use a proxy called Cloud SQL Proxy. Cloud SQL Proxy understands IAM and Service accounts.
The flow will basically look like this:
Your app -> Regular MySQL Port -> Cloud SQL Proxy(Installed in the
app's network or locally) -> CloudSQL
You will need to do the following:
Create a service account
Assign the role of Cloud SQL Client to the created service account
Download the service account key in the json format
Set env variable GOOGLE_APPLICATION_CREDENTIALS=C:\Downloaded.json
Download Cloud SQL Proxy
Run it `cloud_sql_proxy -instances=projectname:regioname:instanceid=tcp:3306
At this point you MySQL proxy ready to accept connections at 3306, modify the connection string to take localhost or wherever you installed the Cloud SQL Proxy.
Learn more at About the Cloud SQL Proxy
You can create the Cloud Run app from the console (and select the Cloud SQL Connection) or from the gcloud command line and specify
--add-cloudsql-instances <INSTANCE-NAME> --set-env-vars INSTANCE-CONNECTION-NAME="INSTANCE_CONNECTION_NAME"
These settings automatically enable and configures the Cloud SQL proxy. You can connect to the proxy, from your asp.net Core app, using the unix domain socket using the format: /cloudsql/INSTANCE_CONNECTION_NAME.
I used the following connection string in my appsettings.json and it worked for me:
"Server=/cloudsql/INSTANCE_CONNECTION_NAME;Database=DB_NAME;Uid=USER_NAME;Pwd=PASSWORD;Protocol=unix"
NB. Make sure you have given the service account that your Cloud Run app is running under Cloud SQL Client role in IAM

could not access azure mysql

I have a MySQL server database running on Azure. It has already running to store data from my ASPX web apps hosted on Azure also. I have plan to migrate the apps to Java JSF or .net core.
I developed using Tomcat server (in my local pc) and try to connect directly to mySql in Azure. But I always get Communications link failure error.
Is it not allow to connect directly from my local Tomcat server to database in Azure, or something else?
Thank you in advance for the answer.
Yes you can connect from your local tomcat to your azure mysql if you have provided the correct connection string.
Also add your ip in the firewall rules of the sql resource.

Connect to GCP Cloud SQL from Compute Engine (not from App Engine)

Typical issues for teams that are migrating from AWS to GCP. How to properly connect to Cloud SQL from Compute engine.
In short that what you should know about Cloud SQL service at GCP.
As I see SQL Cloud more API rather clean MySQL socket tend to work with App Engine rather as plain DB.
List of options that you have to validate and use Cloud SQL without involving developers:
Connection using mysql-client or SQL protocol from external machine or even from Compute Engine requires to add your IP to whitelist. Keep in mind that Compute Engine you will be forced to use static IP due security limitations.In production you should use IP address with SSL
To validate connection from Compute Engine you should use Cloud Shell and gcloud utility
gcloud sql connect [INSTANCE_ID] --user=root
Other option that works only with Second Generation of instances and can be (should be) used in production is SQL Proxy that should be installed on client Compute engine and run as service. You need:
Enable SQL Cloud API
Create and use Service Account with MySQL Client permissions for your instance
Install and run SQL Proxy
Connect to localhost to use proxy as bridge to your SQL Cloud Instance
As result there open questions about "best practices" for production use:
How to automate it in the way that new instances in autoscaling group would be able to connect to Cloud SQL after start? My approach: create template that will start SQL Proxy as service. Is there another way?
How to connect to multiple Cloud SQL instances form the same Compute Engine?

How to access mysql database at multiple sites without using remote jdbc connection

The idea to access multiple remote mysql databases some 30 in numbers using remote jdbc connection in my java application has been ruled out by the DBA's. No remote connection is permitted to the respective mysql DB. Connection can only be allowed from the local j2ee app servers within the LAN.
Alternatives suggested are :
1) Using a Middle ware Messaging layer which invoke some java at the remote side to provide the database results.
2) Using a Web Service on the remote MySQL database site as these site have J2EE App Servers to return the database query results. However i understand that the JDBC resultset cannot be serialized in a web service call and needs to be handled separately.
As the requirement is that the web service call will be using and SQL Query and the Result is to be returned to the Client. How efficiently this can be achieved.
Thinking of what other options are available.
Regards
Pramod.

connecting azure website to sql server database on external server

I had hosted my site on Azure and my database to azure sql databse but the problem with azure sql database does not support data encryption and for that reason I have to move my sql database to external server.
Now I do not know how I can connect that sql database to azure site?
I found one solution to use service bus but they used WCF console application as a service bus listener which I do not know how to create and host WCF.
I appreciate code sample if anything I need to do in my code or application other than connection string setup.