Connect to data MySql

Hello everyone,

Let me begin saying that I looked a lot before creating this topic, but if it is already discussed somewhere, then my apologies.

I’m trying to create an desktop app which connects to an Oracle database using Hibernate and c3p0. My goal is to provide the username and password dynamically on a JavaFX application, so far I managed this part successfully. However, what I’m not managing to achieve is to handle the very likely scenario when the user will type invalid credentials.

For this part, I’m using a javafx.concurrent.Task to connect on Hibernate which I would handle the exception, but that problem is that Hibernate never thrown any of the exceptions I’m trying to handle on my code. It looks like its exception is independent on the code, so I’m not able to provide a feedback for the users mentioning the credentials are invalid for them to reenter.