Closed PhilipDukhov closed 3 years ago
Yes, I haven't got any responses from there that's why I decided to ask here
No problem - just trying to tie the breadcrumbs together incase the solution is discovered in a different location :)
I'll let @shubha-rajan take a more detailed look, but my first guess is that the java-connector isn't added as a dependency for your project.
Indeed, so stupid of me :D
After updating it, I got next error:
java.sql.SQLSyntaxErrorException: Unknown database 'project-name-db'
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:120)
at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122)
at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:833)
at com.mysql.cj.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:453)
at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:246)
at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:198)
at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:138)
at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:364)
at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:206)
at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:476)
at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:561)
at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:115)
at com.zaxxer.hikari.HikariDataSource.<init>(HikariDataSource.java:81)
Also in logs I noticed following warning:
Exceeded hard memory limit of 256 MB with 261 MB after servicing 0 requests total. Consider setting a larger instance class in app.yaml
Is it normal considering my app crashes on trying to connect to the database? I haven't found any parameters related to memory limit, I checked here
Have you created a database in your Cloud SQL instance? From the info you shared, it looks like your instance name and database name are the same. The error suggests that either your database doesn't exist, or that the name is wrong.
The instance class issue with AppEngine seems unrelated to the database connection issues
Oh I see now, I thought I need to take DB_NAME
from sql instances describe
, but those are different things. Works now
I'm following this guide
I'm filling the config like this:
output of the
gcloud sql instances describe project-name
:from which I'm filling my env variables:
On the deployed app line
val dataSource = HikariDataSource(datasourceConfig)
crashes with the following exception:I've tried adding
google
between second and third slashes("jdbc:mysql://google/$DB_NAME"
), according to this answer, but I still get: