Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Connection...

 
Zeina Afif
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Our office is new in implementing J2E technology. We are set up with JRun and ms sql server. The db admin was horrifed when he opened the sql server log and saw all the connections by one of my applications.
Basically, the site queries the db almost at every page, to collect, display the different info. So everytime the user browses a page, data is being pulled from sql.
Am I doing anything wrong? I thought that everytime I connect, I should close the connection.
 
james edwin
Ranch Hand
Posts: 393
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Zeina Afif ,
What i will suggest here is to store everything in application level,so that u donot have to go to Database again and again.
This is much better solution.Instead of getting information on each page from database.Store in APP level.
See if this fits in your problem.

Thanks
 
Graeme Brown
Ranch Hand
Posts: 193
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Setting up or tearing down a connection to a database is a fairly heavyweight process. You should do this as little as possible by caching connections.
Of course if you use a JDBC2 Datasource this will be done for you.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic