Giter Site home page Giter Site logo

cloud-sql-mysql-socket-factory's Introduction

Build Status

Cloud SQL MySQL Socket Factory

The Cloud SQL MySQL Socket Factory is a socket factory for the MySQL JDBC driver that allows a user with the appropriate permissions to connect to a Cloud SQL database without having to deal with IP whitelisting or SSL certificates manually.

Obtaining

The library is available in Maven Central.

Add a dependency using your favorite build tool. Maven and Gradle examples are shown below.

Note: If you wish to use the 6.x (development) version of the MySQL driver, use the artifact id 'mysql-socket-factory-connector-j-6'.

Maven

<dependency>
    <groupId>com.google.cloud.sql</groupId>
    <artifactId>mysql-socket-factory</artifactId>
    <version>1.0.2</version>
</dependency>

Gradle

compile 'com.google.cloud.sql:mysql-socket-factory:1.0.2'

Using

When specifying the JDBC connection URL, add two additional parameters:

Property Value
cloudSqlInstance The instance connection name (which is found on the instance details page in Google Developers Console)
socketFactory com.google.cloud.sql.mysql.SocketFactory

For example, if the instance connection name is foo:bar:baz, the JDBC URL would be jdbc:mysql://google/mydb?cloudSqlInstance=foo:bar:baz&socketFactory=com.google.cloud.sql.mysql.SocketFactory

A tool is available in examples/getting-started that can help you generate the right JDBC URL.

Credentials

The library needs to obtain credentials in order to retrieve SSL certificates that are used to connect to the instance. Application Default Credentials are used for this purpose.

On Google Compute Engine and Google App Engine, the VM/application service account is used.

For local development, application default credentials written by gcloud are used, if present. You must run gcloud auth application-default login once for the credentials to become available to the library.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.