Java tutorial
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package tests; import org.hibernate.cfg.Configuration; /** * * @author Phan Ba Hai */ public class ReadHibernateConfig { public static void main(String[] args) { Configuration config = new Configuration(); config.configure("hibernate.cfg.xml"); System.out.println("db username: " + config.getProperty("hibernate.connection.username")); System.out.println("db password: " + config.getProperty("hibernate.connection.password")); System.out.println("url: " + config.getProperty("hibernate.connection.url")); } }