How to connect MySQL with java application

Hi, I tried to build an application which is using MySQL db
But I am facing jdbc connection issue,can anyone help on this
Here is my .gitlab-ci
Services:
-mysql:5.7
Build:
Image:maven

  • mvn package

I am passing variables like MySQL host user and password also