Trying to connect to MySQL instance using Scio (Apache Beam)

203 views
Skip to first unread message

Vasileios Lioutas

unread,
Jul 10, 2018, 8:58:59 AM7/10/18
to Google Cloud SQL discuss
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

Jordan (Cloud Platform Support)

unread,
Jul 10, 2018, 6:22:59 PM7/10/18
to Google Cloud SQL discuss
Scio is not a Google supported API. As per our documentation example, if you are using the standard java.sql.DriverManager this should work for you. If you are having issues with Scio's implementation it is recommended to directly report the issue in their Github Issue Tracker, as Google Groups is reserved for general Google product discussions and not for technical support. 
Reply all
Reply to author
Forward
0 new messages