in bamboo receiving the following error: Could not open Hibernate Session for transaction; nested exception is net.sf.hibernate.exception.GenericJDBCException: Cannot open connection, how do fix it?
Asked by adbarads:

In Bamboo 5, I am recieving the following error in bamboo:

System Error Details {#toc-hId-1815390977}
==========================================

*[Build Ionic Fusion - Ionic Fusion Testing - UnTar 568](http://bamboo.in.ionicsecurity.com:8085/browse/SFB-SFB-ETQS-568) :* Build Labeller custom build post complete action failed to run  
(org.springframework.transaction.CannotCreateTransactionException : Could not open Hibernate Session for transaction; nested exception is net.sf.hibernate.exception.GenericJDBCException: Cannot open connection)

Occurred: 25 Jul 2013, 3:02:59 PM

*** ** * ** ***

```
org.springframework.transaction.CannotCreateTransactionException: Could not open Hibernate Session for transaction; nested exception is net.sf.hibernate.exception.GenericJDBCException: Cannot open connectionCaused by: net.sf.hibernate.exception.GenericJDBCException: Cannot open connection	at net.sf.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:80)	at net.sf.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:69)	at net.sf.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:29)	at net.sf.hibernate.impl.BatcherImpl.convert(BatcherImpl.java:328)	at net.sf.hibernate.impl.BatcherImpl.openConnection(BatcherImpl.java:295)	at net.sf.hibernate.impl.SessionImpl.connect(SessionImpl.java:3375)	at net.sf.hibernate.impl.SessionImpl.connection(SessionImpl.java:3335)	at org.springframework.orm.hibernate.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:422)	at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:350)	at sun.reflect.GeneratedMethodAccessor107.invoke(Unknown Source)	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)	at java.lang.reflect.Method.invoke(Method.java:601)	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:304)	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:198)	at com.sun.proxy.$Proxy18.getTransaction(Unknown Source)	at org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:262)	at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:101)	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)	at com.sun.proxy.$Proxy43.getPlanByKey(Unknown Source)	at com.atlassian.bamboo.v2.build.events.PostBuildCompletedEventListener$1.run(PostBuildCompletedEventListener.java:70)	at com.atlassian.bamboo.variable.CustomVariableContextRunnerImpl.execute(CustomVariableContextRunnerImpl.java:27)	at com.atlassian.bamboo.v2.build.events.PostBuildCompletedEventListener.performAction(PostBuildCompletedEventListener.java:54)	at com.atlassian.bamboo.v2.build.events.PostBuildCompletedEventListener.handleEvent(PostBuildCompletedEventListener.java:41)	at com.atlassian.event.legacy.LegacyListenerHandler$LegacyListenerInvoker.invoke(LegacyListenerHandler.java:55)	at com.atlassian.bamboo.event.spi.EventInvokerRunnable.run(EventInvokerRunnable.java:28)	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)	at com.atlassian.bamboo.build.pipeline.concurrent.NamedThreadFactory$2.run(NamedThreadFactory.java:52)	at java.lang.Thread.run(Thread.java:722)Caused by: java.sql.SQLException: Connections could not be acquired from the underlying database!	at com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:106)	at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:529)	at com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.getConnection(AbstractPoolBackedDataSource.java:128)	at net.sf.hibernate.connection.C3P0ConnectionProvider.getConnection(C3P0ConnectionProvider.java:33)	at net.sf.hibernate.impl.BatcherImpl.openConnection(BatcherImpl.java:292)	... 25 moreCaused by: com.mchange.v2.resourcepool.CannotAcquireResourceException: A ResourcePool could not acquire a resource from its primary factory or source.	at com.mchange.v2.resourcepool.BasicResourcePool.awaitAvailable(BasicResourcePool.java:1319)	at com.mchange.v2.resourcepool.BasicResourcePool.prelimCheckoutResource(BasicResourcePool.java:557)	at com.mchange.v2.resourcepool.BasicResourcePool.checkoutResource(BasicResourcePool.java:477)	at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:525)	... 28 more
```


Answers:
author: Jay Chang
body: I corrected the database username/password in ${bamboo.home}/bamboo.cfg.xml, then restarted bamboo. That fixed my problem.

JC


author: Jay Chang
body: Hi all,

I have the same problem after switched from embeded database to Mysql database in Bamboo 5.5. It seems that the database configuration in Bamboo provides no editing capability to change or test the connection. Does anyone have a solution for this issue?

Thanks in advance,

JC