can someone help me with any sample working code or any project that I can look at? I have been searching this on google for few days but I always end up an answer with spring boot but I need to connect without using spring boot. I need to write automated API tests where I have to connect to cloud Sql fetch the data from Db and validate it.
As @siamsot mentioned, there is an article in the official GCP documentation on how to connect to a Cloud SQL instance.
Basically, you have the following options to connect to a Cloud SQL instance: