Hello Jitendra
Reflection is rather not a nice solution here :>
Finally I have found a solution. Piece of code:
Code:
final SessionFactoryImplementor sessionFactoryImplementor =
(SessionFactoryImplementor) HibernateUtil.getSessionFactory();
final Settings settings = sessionFactoryImplementor.getSettings();
ConnectionProvider connectionProvider = settings.getConnectionProvider();
Connection connection = connectionProvider.getConnection();
DatabaseMetaData databaseMetaData = connection.getMetaData();
String url = databaseMetaData.getURL();
And url has a following format:
jdbc:oracle:thin:@chmiel.unx.xxx.yy:1521:
MYDATABASENAME
btw:
Thanks for your replies, Jitendra!
Kind regards,
Adam