-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: Connection pooling in hibernate
PostPosted: Tue Nov 28, 2006 9:17 am 
Newbie

Joined: Mon Nov 20, 2006 2:12 am
Posts: 8
Location: Gurgaun
Hi to all!!

I am trying to use connection pooling in hibernate.
Server I am using is Tomcat5.0
database I am using is DB2 v-8.1

Connection is successful without connection pooling. Everything is working fine without it.

But when implementing connection pooling, I am getting the error.

Code:
"org.hibernate.exception.GenericJDBCException: Cannot open connection"

The context setting is:-
Code:
<Context docBase="HibernateOnlineTest2" path="/HibernateOnlineTest2" reloadable="true" source="org.eclipse.jst.j2ee.server:HibernateOnlineTest2">

<Resource
name="jdbc/hibernateTest"
auth="Container"
type="javax.sql.DataSource"
removeAbandoned="true"
removeAbandonedTimeout="30"
maxActive="100"
maxIdle="30"
maxWait="10000"
username="administ"
password="ggsl"
driverClassName="com.ibm.db2.jcc.DB2Driver"
url="jdbc:db2://localhost:50000/hibernat"
factory="org.apache.commons.dbcp.BasicDataSourceFactory"/>

</Context>


and a resource ref in web.xml
Code:
<resource-ref>
<description> DB Connection Pooling</description>
<res-ref-name> jdbc/hibernateTest</res-ref-name>
<res-type> javax.sql.DataSource</res-type>
<res-auth> Container</res-auth>
</resource-ref>

and using this resource ref in hibernate.cfg.xml
Code:
<property name="dialect">org.hibernate.dialect.DB2Dialect</property>

<property name="connection.datasource"> java:comp/env/jdbc/hibernateTest</property>


is this a problem of driver I am using(com.ibm.db2.jcc.DB2Driver), i.e. for implementing connection pooling we have to specify any other driver, if yes then which one.

I am using the following properties for connecting without connection pooling:
Code:
<property name="connection.driver_class">com.ibm.db2.jcc.DB2Driver</property>
<property name="connection.url">jdbc:db2:hibernat</property>
<property name="connection.username">administ</property>
<property name="connection.password">ggsl</property>
<property name="connection.pool_size">10</property>

This way it is running fine.

Please help me out.

_________________
Thanks & Regards
Sumit Tyagi.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 28, 2006 11:23 am 
Senior
Senior

Joined: Mon Oct 23, 2006 5:12 am
Posts: 141
Location: Galicia, Spain
Post complete stack trace

_________________
andresgr (--don't forget to rate)


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 29, 2006 1:23 am 
Newbie

Joined: Mon Nov 20, 2006 2:12 am
Posts: 8
Location: Gurgaun
Full stack trace is:
Code:
org.hibernate.exception.GenericJDBCException: Cannot open connection
   at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103)
   at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91)
   at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
   at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:29)
   at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:420)
   at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:144)
   at org.hibernate.jdbc.JDBCContext.connection(JDBCContext.java:119)
   at org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:57)
   at org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1326)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:585)
   at org.hibernate.context.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:301)
   at $Proxy0.beginTransaction(Unknown Source)
   at onlinetest.servlet.login.Login.performTask(Login.java:48)
   at onlinetest.servlet.login.Login.doGet(Login.java:27)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:743)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
   at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
   at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
   at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
   at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
   at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
   at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
   at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
   at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
   at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
   at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:535)
   at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
   at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
   at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
   at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
   at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:790)
   at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:709)
   at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:572)
   at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:644)
   at java.lang.Thread.run(Thread.java:595)
Caused by: java.sql.SQLException: Cannot load JDBC driver class 'null'
   at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:529)
   at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:312)
   at org.hibernate.connection.DatasourceConnectionProvider.getConnection(DatasourceConnectionProvider.java:69)
   at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:417)
   ... 40 more

_________________
Thanks & Regards
Sumit Tyagi.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 29, 2006 2:33 am 
Newbie

Joined: Mon Nov 20, 2006 2:12 am
Posts: 8
Location: Gurgaun
Sorry!! again my mistake.
Some of the settings were wrong in the server, that's why it was not able to find the reference to the resource.

Now it is running.

Thanks andresgr.

_________________
Thanks & Regards
Sumit Tyagi.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.