-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Driver does not support socket connection #9985
Comments
In order to use Cloud Sql you need to use a dedicated socker factory. You need to configure your datasource to use it. You also need to configure the instance name. Can you try adding these two properties to the Something like this should work:
|
I fixed this issue with cloud sql proxy. So I backtracked and set these 2 additionals property, get application credentials too. So either quarkus.datasource.additional-jdbc-properties.socketFactory or quarkus.datasource.socket-factory don't fix this issue I see an active PR here (https://github.com/quarkusio/quarkus/pull/6634/files)... Means that it has not been deployed yet ? |
@anthonydenecheau you're right, the We should implement it ! |
Ok merci Loïc. I hope to see this new feature in the next realease 1.5.2. Keep it up guys, great work |
@anthonydenecheau |
@loicmathieu I’ve tested this afternoon and It works for me. But I have to put in this way: |
@lferna a map means you can put whatever key you want after @gsmet now that the PR for additinal JDBC properties is merged, I think we need to put inside our documentation how to configure the datasouce for Google Cloud SQL with the two needed properties. Where do you think we need to document this ? Inside our Datasource guide or inside our Deploy to Google Cloud Guide (or both) ? |
Documentation for how to use Quarkus with Google Cloud SQL would be neat; especially because with a random web search and finding e.g. #5901 and #6634 and stumbling across related https://github.com/jtama-op/quarkus/commit/eb27113c050b2c98a0ef046a84d366484adf6e21, one could think this needs more work - when, actually, it does seem to work just fine using e.g. Quarkus 1.10.5 as-is, simply using a The trickiest part can be how to correctly set up all the required pre-requisites on GCP for this connection to work from a Quarkus service running on AppEngine Standard; see GoogleCloudPlatform/cloud-sql-jdbc-socket-factory#375. |
@loicmathieu Do you know if the same is available for |
You are write, but that jdbc url feels like a hack, and additional-jdbc-properties are the right way. |
@jtama the reactive clients are based on Vert.x reactive database driver. I don't know if those supports all the configuration options as the JDBC variants. |
@loicmathieu So I have answer bits :
Creating an issue (eclipse-vertx/vertx-sql-client#929). |
ok so it does work with reactive client with the following dependencies (choose one depending on your os): <dependency>
<groupId>io.netty</groupId>
<artifactId>netty-transport-native-kqueue</artifactId>
<classifier>osx-x86_64</classifier>
<version>4.1.49.Final</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-transport-native-epoll</artifactId>
<classifier>linux-x86_64</classifier>
<version>4.1.49.Final</version>
</dependency> and the following configuration : %gcp.quarkus.datasource.reactive.url=postgresql://:5432/db-name?host=/cloudsql/project-id:zone:db-name
%gcp.quarkus.vertx.prefer-native-transport=true I think we should document it. |
@gsmet We still need to document how to connect using unix domain socket for use with reactive pg driver. |
@jtama As per your comment, I'm trying to connect my quarkus app on GAE with a GCP cloud SQL instance. The below configuration did not help and I'm still getting the same error.
Also added this to my pom.xml
When you say the OS for netty do you mean the OS that runs the jar or the OS that built it? I believe GCP GAE runs Linux by deafult. Any help here would be greatly appreciated. I'm building a solution for big billion $ company on GCP and we are fixated with reactive but sadly this doesn't work. I believe in the potential of quarkus but need this to work for my demo. Thanks in advance, you are also right about adding documentation for reactive, the problem isn't resolved yet. @gsmet This thread should not be closed yet. This still doesn't work with reactive pg. |
It’s a bit old but i think you should remove the host IP. |
@jtama Appreciate your quick response. Can you please share a working example for reactive pgsql. Tried removing the host but it still doesn't work for me. |
And for the dependency, it depends on the host running the application. <dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-reactive-pg-client</artifactId>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-transport-native-epoll</artifactId>
<classifier>linux-x86_64</classifier>
<version>4.1.49.Final</version>
</dependency>
<dependency>
<groupId>com.google.cloud.sql</groupId>
<artifactId>postgres-socket-factory</artifactId>
<version>1.2.1</version>
</dependency> And my application.properties :
|
@jtama Apologies I just got confused by the configuration provided in https://quarkus.io/guides/deploying-to-google-cloud#using-cloud-sql. If I am using reactive, do I need any of the configurations provided below:
It will be very helpful to list the configuration for reactive separately as I've noticed that some others are facing the same confusion as in comments of eclipse-vertx/vertx-sql-client#929. |
@compasspenguin I created a PR to add this to the documentation last week, you can check it here: With the reactive client: no need for the socker factory lib, only the
Be aware that this only works inside a Google managed runtime like Appengine. |
Awesome, thank you! This worked perfectly. As it turns out, specifying the epoll version was causing issues. |
Describe the bug
I try to connect a projet, build in native mode and deploy on google cloud run, to google sql.
Expected behavior
My app cannot reach google sql
Actual behavior
I get an error :
ERROR [org.hib.eng.jdb.spi.SqlExceptionHelper] (main) Driver does not support the provided URL: jdbc:postgres://[user]:[pwd]@/[db-name]?unix_sock=/cloudsql/[db-connection-name]"
To Reproduce
Steps to reproduce the behavior:
Configuration
Pom.xml
application.properties
Where variables are environnements variables on google cloud run
Environment (please complete the following information):
uname -a
orver
:java -version
:mvnw --version
orgradlew --version
):Additional context
Dockerfile.multistage
Note : find this feature : https://github.com/jtama-op/quarkus/tree/18280ee018d82acef601fc022a5c6923bfb7a451/extensions/agroal
The text was updated successfully, but these errors were encountered: