Monday, July 9, 2018

[google-cloud-sql-discuss] Trying to connect to MySQL instance using Scio (Apache Beam)

Hi,

I'm trying to connect to a MySQL instance using the following example from Scio, a library for using Apache Beam with Scala. I'm trying this in DirectRunner (local machine) but I can't get connected to the DB. The JDBC URL I use is the following: "jdbc:mysql://google/dbname?cloudSqlInstance=xxx:us-central1:yyy&socketFactory=com.google.cloud.sql.mysql.SocketFactory". For username and password I use a custom user I made (I tried it with the root user as well but no luck). I also have enabled the SQL API from GCP as well as logged in with the gcloud SDK on my local computer. In addition, I whitelisted the IP from my computer (although it suppose to work without whitelisting if you use the above JDBC URL).  The error I get is the following:

Caused by: java.sql.SQLNonTransientConnectionException: Cannot connect to MySQL server on google:3,306.


Make sure that there is a MySQL server running on the machine/port you are trying to connect to and that the machine this software is running on is able to connect to this host/port (i.e. not firewalled). Also make sure that the server has not been started with the --skip-networking flag.

Any idea why it can't connect?

Thank you

--
You received this message because you are subscribed to the Google Groups "Google Cloud SQL discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-cloud-sql-discuss+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-cloud-sql-discuss/67c46cb6-79e0-4c96-9180-b5a1da503558%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment