• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Connection Pooling in Hibernate

 
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, anyone can help me how to get connection pooling in Hibernate, I am using Weblogic server8.1 server. I created a datasource there with pointbase database for test purpose. Now i have jndi name for that datasource.. I dont know how to call that datasource in hibernate..


Abu.A
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just use the hibernate.connection.datasource property instead of defining a connection in your configuration. See the documentation for more.
 
Abubacker Siddik
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I read the article. I understood connection pooling. But Is it enough to mention only hibernate.connection.datasource in hibernate.properties??
 
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Abubacker Siddik wrote:I read the article. I understood connection pooling. But Is it enough to mention only hibernate.connection.datasource in hibernate.properties??



add the connection pooling properties in the hibernate-mapping properties/xml file.
for in-build pooling:
hibernate.connection.pool_size

if you using the the third party liabrary for connection pooling like Apache DBCP then configure like this:

hibernate.dbcp.maxActive
hibernate.dbcp.maxIdle
hibernate.dbcp.maxWait
etc...
 
Paul Sturrock
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
None of the above is necessary if you are using a WebLogic DataSource. What Ranveer is suggesting is useful if you don't want to use WebLogic's DataSource and use DBCP.


I read the article. I understood connection pooling. But Is it enough to mention only hibernate.connection.datasource in hibernate.properties??


Yes. Or in hibernate.cfg.xml. Or programatically. Or as a System property passed at startup. Whichever suits your needs best.
 
Abubacker Siddik
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul, One more doubt..weblogic datasource gives all the connection pooling configuration by default. So as Ranveer suggests, those properties are useful only if we use third parth jdbc connection pooling. But If i wanted to set minimum size of my connection pooling in weblogic datasource or max timeout for the connection..or whatever configuration properties..How can i configure weblogic datasource..?


Thanks in advance.
 
Paul Sturrock
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Its been years since I worked on WebLogic so I can't help I'm afraid. There's nothing you can do in Hibernate to influence this. I recommend having a read of the WebLogic documentation, that should tell you.
 
Life just hasn't been the same since the volcano erupted and now the air is full of tiny ads.
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic