Checking the datasource connection

Sometimes, you might see errors in your log's application because of something going wrong with your persistence storage. The first thing to do in that case, is to check if the database is up and running by testing its connection; you may even realize that you are pointing to a wrong one or you misspelled the connection URL.

Getting ready

This recipe is based on the previous one, where we have configured a datasource which connects to a local MySQL database, so we will test our database connection with the WildFlyCookBookDS datasource. You can test the connection with a datasource of your choice as long as you provide the correct configuration as well.

How to do it...

  1. With a running WildFly server, open your command-line ...

Get WildFly Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.