title: How to read database configuration parameter using properties file in hibernate
body: <p>In my apps I am using hibernate, to connect a with database and create a session. this is my hibernate.cfg.xml file. This is ok. It working properly.</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
   &lt;!DOCTYPE hibernate-configuration PUBLIC
      "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
      "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd"&gt;
  
  &lt;hibernate-configuration&gt;
  
      &lt;session-factory&gt;
          &lt;!-- Database connection settings --&gt;
          &lt;property name="connection.driver_class"&gt;com.mysql.jdbc.Driver&lt;/property&gt;
          &lt;property name="connection.url"&gt;jdbc:mysql://localhost:3306/country&lt;/property&gt;
          &lt;property name="connection.username"&gt;root&lt;/property&gt;
          &lt;property name="connection.password"&gt;password&lt;/property&gt;
  
      &lt;/session-factory&gt;
  
  &lt;/hibernate-configuration&gt;
  </code></pre>
  
  <p>But when I try to read the DB configuration properties using <code>db.property file</code> using this <code>hibernate.cfg.xml</code>, it showing Exception, this is my another <code>hibernate.cfg.xml</code> file</p>
  
  <p>
       </p>
  
  <pre><code>&lt;util:properties id="db" location="classpath:db.properties" /&gt;
  
  &lt;hibernate-configuration&gt;
  
      &lt;session-factory&gt;
          &lt;!-- Database connection settings --&gt;
          &lt;property name="driverClassName" value="#{db['driverClassName']}"&gt;&lt;/property&gt;
          &lt;property name="url" value="#{db['url']}"&gt;&lt;/property&gt;
          &lt;property name="username" value="#{db['username']}"&gt;&lt;/property&gt;
          &lt;property name="password" value="#{db['password']}"&gt;&lt;/property&gt;
  
      &lt;/session-factory&gt;
  
  &lt;/hibernate-configuration&gt;
  </code></pre>
  
  <p>this is the error </p>
  
  <pre><code> org.dom4j.DocumentException: Error on line 8 of document  : The prefix "util" for       element "util:properties" is not bound. Nested exception: The prefix "util" for element   "util:properties" is not bound.
      at org.dom4j.io.SAXReader.read(SAXReader.java:482)
      at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:2155)
  </code></pre>
  
  <p>this is my properties file named <code>db.properties</code></p>
  
  <pre><code>driverClassName=com.mysql.jdbc.Driver
  
  url=jdbc:mysql://localhost:3306/country
  
  username=root
  
  password=password
  </code></pre>
  
  <p>what is the problem is there?
  how to do that properly</p>