Monday, August 5, 2019

Re: [google-cloud-sql-discuss] Can't connect from AppEngine to CloudSql

Hi Caglar,

It's hard to say what you are doing wrong without more details on the exception or the config. It sounds like an option in your config has been configured incorrectly compared to the url. 

The sample from the "Connecting to App Engine" page mentioned above links to this application, which uses a config object to configure Hikari. 

You should also match your mysql-socket-factory-connector version to your driver version. It's strong recommended to use 8.0.x and the `mysql-socket-factory-connector-j-8` version. 

Thanks,
Kurtis

On Sunday, August 4, 2019 at 8:34:34 AM UTC-7, Caglar Mehmet Metin wrote:
Hello sorry for late reply.

I tried with the recommended method. It now works. (with lib: mysql-socket-factory-connector-j-6)
However HikariConfig does not work. It continuesly throws exception. It only works when I connect normally (Using JDBC driver)
Do you have any idea why? 

DataSource pool = new HikariDataSource(config); //(Does not work)
conn = DriverManager.getConnection(url); //works

Both have the same configs and urls.


Thanks and regards. 

29 Temmuz 2019 Pazartesi 19:23:04 UTC+2 tarihinde Pavel Ivanov yazdı:
How do you connect to your instance? Is it the same as described in https://cloud.google.com/sql/docs/mysql/connect-app-engine, or do you connect using your Cloud SQL instance's IP?


On Mon, Jul 29, 2019 at 6:40 AM Caglar Mehmet Metin <caglarme...@gmail.com> wrote:
Hello, 

I have simple Java application. I deployed it to the AppEngine.

When I try to connect to the MySql of GCP CloudSql, I get connectoion error.
It says "Apps in this project. All authorized." 
My java app and CloudSql are in the same GCP app. 

When I add all networks ("0.0.0.0/0"), then it works. However I don't want to add this. 

What could be the reason? Is there something extra that I have to do in order to connect from AppEngine? 

Thanks and regards.

so.PNG

 

--
You received this message because you are subscribed to the Google Groups "Google Cloud SQL discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-cloud-sql-discuss+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-cloud-sql-discuss/f6c3ac39-c157-4471-8cd7-167789f9d1b5%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Google Cloud SQL discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-cloud-sql-discuss+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-cloud-sql-discuss/38284eec-7cee-418d-9e89-aca748180d66%40googlegroups.com.

No comments:

Post a Comment