since the php file is responsible for connect to the database and look for use validation java doesn't have to have access for db for this to work. all you need to do is calling the php endpoint from java .. use some http library to do the post to the php file.
first see if the php file works right manually. you can send a post to the php file using postman. https://www.getpostman.com/docs/v6/postman/sending_api_requests/requests
then look at the output. if its ok then there may be an error in your java code.
and i think this line of code wont work
if ($conn = mysqli_connect("localhost", "id4922470_public", "password","id4922470_cuc_general")) {
}
should replace with
if($conn){
}