• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Connection Pooling in Hibernate

 
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic