I am Creating a app and I though of creating a loding screen with which will check the availablity of database which will use in the application if the connection to database appers to kk then then loading form will open the login form or orelse i want that form to display a error message saying network connectivity issue.

can you give give ideas on how can i work that out ?