I have followed the steps mentioned in the below stackoverflow url and tried to connect my java application which is running on CloudRun to CloudSQL postgres DB. Stackoverflow reference But getting the below error when the db has private IP.
org.postgresql.util.PSQLException: Connection to google:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.
But when its made public things are working as expected and CloudRun instance is stable. I am using shared VPC this is where my CloudSQL instance is running and have created a VPC connector and configured CloudRun to use the VPC connector and shared network.When i make the DB public it works so the connection string used is right but why does it fail when Private IP was enabled ? What am I missing is there some issues with networking side ?