How to check that our Database is connected in java dynamic project in eclipse?

I used an eclipse java dynamic project I want to know that my database is connected or is that working properly I used the xampp apache server and tomcat 9


you can use this usefull method from the java.​sql.​Connection Class:

Connection con = new Connection(/* MY SERVER PARAMETERS */);

boolean valid=con.isValid(/* int millis */);
System.out.println("The connection is active?" + valid);

Hope this link can help you:

Leave a Reply

Your email address will not be published. Required fields are marked *