I am trying to connect to DB in a servlet using Hibernate.I have read that we can use either hibernate.cfg.xml or hibernate.properties file for configuration of session.For me i
If you are using a database from a servlet then you should define a DataSource in your server and point one hibernate property at that instead of defining everything via all the other hibernate properties you're probably using now.
This has the benefit of permitting you to define connection pooling and other connection related parameters independently of your application.
For example, your production environment is likely to have a different database password than your test and development environments.