Connect with existing MySQL database (OVH) from Cloud Functions - mysql

I have an existing database hosted by OVH and managed by PhpMyAdmin.
On the other side, I also have a Firebase project where I use several Cloud Functions.
I would like write, in my existing OVH database, datas from my Firestore collections (thanks to Cloud Functions).
Is there a way to connect my Cloud Functions to an existing database ?
I did read than is possible to connect Cloud Functions to MySQL database with Cloud SQL but it seems only for new database created from Cloud Platform, which is not my usecase as my database is already created and hosted by OVH.
Thank you for your help!

Depending on the programming language you are using on Cloud Functions, PHP for example:
1. <?php
2. $myPDO = new PDO('pgsql:host=host;port=port;dbname=dbname', 'username', 'password');
3. ?>
From what I can tell on the documents, you have to make sure your database is public, not private. Here is the official documentation.
If you have any issues, try reaching out to OVH support.

Related

Connect appscript to database

I have this project on appscript where all the data are stored in gsheet. Now we have a db which is microsoft sql azure management, how will I transfer all the data of my appscript to that database?
As far as I know the way to connect to external databases is JDBC. Making the connection is often the most difficult part of the process of interacting with an external database.
Most users find the interface slow and not very efficient.
JDBC

Dump of SQL database of instance via Cloud SQL Admin API v1beta4

I've created Cloud Function written in node.js to make dump of database in SQL instance and I'm wondering, is there any recommendation about stopping all instance before making dump? I stopped instance, but after that i couldn't make "dump".
There is a documentation: https://cloud.google.com/sql/docs/mysql/admin-api/rest/v1beta4/instances/export

can we setup a sync of databases between on-premises MySQL server to Azure Database for MySQL

by using mysqldump I am able to migrate data from on-premises to Azure Database for MySQL. but now after dump and restore i want to create a continuous sync between them. how's it possible?
I have followed below link but havn't achieved it. Is it possible or not?
https://learn.microsoft.com/en-us/azure/mysql/howto-data-in-replication#other-useful-stored-procedures-for-data-in-replication-operations
Looks like there is no prebuilt service available in azure.
You can find more information on this Link

need to connect my same apps with one database

i have 3 servers for three applications on aws ec2 using MySql database,
now each of the application is having amember that is client subscription app,
it connects with sql databse that is created in each instance
so in this way every amamber app is having diffrent database in each server,
now we are working with a device ROKU we need to pass the XML attributes from amember to it
to varify the user so he can watch online streaming tv.
the objective
now i need to make one database that will be connected with each server using amember
so each server access one database .
Options
my options are aws RDS ,dynamoDb
Now can anyone put me in the right direction, for that.
in simple Words
need to connect my multiple apps (same app) with one database
HELLLLP
If you need to connect to a mysql database, DynamoDB is not the answer. It isn't a mysql database.
RDS is a mysql database. It connects like any other mysql database. You haven't mentioned what language[s] you are using, however. Googling "connect to mysql with [language]" should help.
I think it would be best to stick with relational databases such as MySQL.
Amazon RDS is a managed MySQL solution, but you don't have to use it for your needs.
You can use one of your EC2 instances or a new EC2 instance as the central DB and connect all the other servers to it for quires. There are pros and cons for choosing RDS over your own SQL server. If you have any questions there, feel free to edit your question and add them.
EDIT according to comment
In order to connect your application with the local MySQL. Your are probably using a connection string that points to either "localhost" or "127.0.0.1"... That is the IP of your local machine. You will have to change it to the remote IP of the machine where the DB is stored remotely.

How to 'switch' from MySQL to Amazon RDS with minimal application impact?

Amazon officially states: "Amazon RDS gives you access to the full capabilities of a familiar MySQL database. This means the code, applications, and tools you already use today with your existing MySQL databases work seamlessly with Amazon RDS."
I don't get this. Amazon RDS is accessible via web services and there a client libraries (like the one for .Net).
So if I have an existing .Net application that uses a DAL which in turn queries MySQL, how can I make the same DAL talk to the Amazon RDS (via the web services). Or am I missing something here?
Amazon RDS is pure MySQL, accessible by your app the same way as any other MySQL database; the web services interface to RDS is purely for creation, deletion, and modification of the DB instances, not the DB data. From their FAQ:
Q: How do I access my running DB
Instance?
Once your DB Instance is available,
you can retrieve its
endpoint via the DescribeDBInstance
API. Using this endpoint you can
construct the connection string
required to connect directly with your
DB Instance using your favorite
database tool or programming language.
In order to allow network requests to
your running DB Instance, you will
need to authorize access. For a
detailed explanation of how to
construct your connection string and
get started, please refer to our
Getting Started Guide.
This is the part of the Getting Started Guide you need -- it explains how to get the hostname of your new instance so you can connect to it, authorize the instance for access from the client, and then connect using the MySQL command-line client (as an example):
$ rds-describe-db-instances --headers
$ rds-authorize-db-security-group-ingress default --cidr-ip 192.0.2.0/30 --headers
$ mysql -h myinstance.crwjauxgijdf.us-east-1.rds.amazonaws.com -P 3306 -u mymasteruser -p
Amazon RDS is just a normal server with normal MySQL access. There's only the webservice that handles instance creation etc., but everything mysql related is still the same.