0

I'm trying to create a spring boot application that inserts some data into GCP Mysql.But everytime I'm trying to run application it shows exception -

  java.sql.SQLNonTransientConnectionException: Could not create connection to database server.
Caused by: java.io.IOException: The Application Default Credentials are not available. They are available if running in Google Compute Engine. Otherwise, the environment variable GOOGLE_APPLICATION_CREDENTIALS must be defined pointing to a file defining the credentials

Now following is my application.properties file.Actual paparmeters not defined here-

     spring.cloud.gcp.sql.database-name=DemoDatabase
        spring.cloud.gcp.sql.instance-connection-name=xxxxxxxxxxx
        spring.datasource.initialization-mode=always
spring.cloud.gcp.credentials.location=C:/Users/utkar/Downloads/spring-boot-7208e0222fb1.json
    spring.datasource.url=jdbc:mysql://google/DemoDatabase?cloudSqlInstance=XXXXXXXXXXX&socketFactory=com.google.cloud.sql.mysql.SocketFactory&useSSL=false
        spring.datasource.username=XXXXX
        spring.datasource.password=XXXXXX

Please help.Thanks in advance

0

1 Answer 1

2

Run the following command on the CLI:

gcloud auth application-default login
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.