connection « Test « JPA Q&A





1. How to test connection validity?    forum.hibernate.org

Hi, I have an application where the user can define connection parameters like server address, user name and password to the database. But I'm not able to check if the connection succeeds. I've written this code but although the connection parameters are invalid no exception is thrown. Code: try { ...

2. How to test if connection was established ?    forum.hibernate.org

When I start my application I call Configuration.buildSessionFactory(). If an error occurs while hibernate try to connect database, to get metadata or anything, I would like to handle this error, however hibernate isn't throwing an exception ... even if use openSession() I have an error !!! How can I test if connection was established ?

3. connection pooling, app server, and tests    forum.hibernate.org

When running an application in an app server, the advice that comes the most often is to rely on the server db connection pooling system, rather than on a third party like c3p0, proxool or dbcp. Why ? Are these 3rd party pools not fully stable - or considered as less than those from app servers vendors - or is it ...

4. How to test connection validity ?    forum.hibernate.org

Hi, In my application, users could dynamically change DB connection parameters (like database host or database username). Since openSession() never fails, I wanted to test the session validity after opening it. "session.isConnected()" and "session.isOpen()" seems to always return true even if I'm badly mis-configuring my database (to an inexistant host for instance). So until now I used a dummy HQL quey ...