Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Connection Pooling in Hibernate

 
Abubacker Siddik
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
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate 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??
 
Ranveer K Kumar
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
Eclipse IDE Hibernate 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
Eclipse IDE Hibernate 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic