question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Autoconfigure R2DBC support for Cloud SQL

See original GitHub issue

When using the Spring Cloud GCP Cloud SQL PostgreSQL starter (spring-cloud-gcp-starter-sql-postgresql) you get a JDBC-based stack using org.springframework.boot:spring-boot-starter-jdbc and the org.postgresql:postgresql JDBC driver.

For Spring WebFlux applications I would like to be able to use Cloud SQL via R2DBC instead of JDBC.

I can use R2DBC with Spring Boot and a plain PostgreSQL database via org.springframework.boot:spring-boot-starter-data-r2dbc and the io.r2dbc:r2dbc-postgresql R2DBC driver for PostgreSQL.

I have found https://github.com/GoogleCloudPlatform/cloud-sql-jdbc-socket-factory/blob/master/r2dbc-postgres and an example project at https://github.com/GoogleCloudPlatform/java-docs-samples/tree/master/cloud-sql/r2dbc that shows what dependencies to add and how to create a ConnectionFactory bean, but it would be great if Spring Cloud GCP would have a starter and auto-configuration for this, so Spring Cloud GCP users don’t need to manage and configure these dependencies.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:9
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
olaf-2commented, Nov 16, 2021

Yes, did not work. Now I retried with this little :gcp: in the URL I had overlooked and it works. (⌒_⌒;) Thanks.

0reactions
elefeintcommented, Nov 17, 2021

It does in that we can make the correct ConnectionFactory creation automatic given a dependency on R2DBC and socket factory. I’ll update the issue title to reflect that.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using the open-source R2DBC driver | Cloud Spanner
Your application can make use of the reactive database connectivity with Spanner by using the Spanner R2DBC driver. Adding Dependencies. Spring Data users ......
Read more >
Use Spring Data R2DBC with Azure SQL Database
Configure Spring Boot to use Azure SQL Database​​ Replace the two $AZ_DATABASE_NAME variables and the $AZ_SQL_SERVER_PASSWORD variable with the ...
Read more >
Getting Started | Accessing data with R2DBC - Spring
This guide walks you through the process of building an application that uses Spring Data R2DBC to store and retrieve data in a...
Read more >
Working With Relational Database Using R2dbc DatabaseClient
The DatabaseClient.builder() provides a flexible way to setup the parameter binding strategy in SQL queries. If you are using Spring Boot, just ...
Read more >
Spring Cloud GCP
R2DBC Support. 6.1. Prerequisites; 6.2. Spring Boot Starter for Google Cloud SQL. 7. Cloud SQL IAM database authentication; 8. Cloud SQL Configuration ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found