title: How do I access MySQL from CloudBees Jenkins?
body: <p>I cannot figure out how to access a MySQL database while running in Jenkins CloudBees. I have tried following the <a href="http://wiki.cloudbees.com/bin/view/DEV/MySQL" rel="nofollow">Dev@Cloud MySQL</a>, but there are a lot of warnings in the console output and I have to deal with localhost access vs. sockets, which is pretty tricky to debug without a command line.</p>
  
  <p>Is there a way to use the CloudBees MySQL hosting? When I try and use the cloudbees JDBC driver, I get ClassNotFound error messages.</p>
  
  <p><strong>Update</strong>: The answer below clarified that I cannot use the CloudBees driver, so I am now using the regular MySQL connector through the c3p0 connection pool. Based on comments below, I have limited the number of connections in the pool to 10. </p>
  
  <p>The exact same configuration and Maven command line works when I run it from my development computer, connecting to the Cloudbees Mysql instance.</p>
  
  <p>Unfortunately, I get this error when trying to connect:</p>
  
  <pre><code>Caused by: com.googlecode.flyway.core.exception.FlywayException: Unable to obtain Jdbc connection from DataSource
      at com.googlecode.flyway.core.util.jdbc.JdbcUtils.openConnection(JdbcUtils.java:56)
      at com.googlecode.flyway.core.Flyway.execute(Flyway.java:864)
      at com.googlecode.flyway.core.Flyway.migrate(Flyway.java:591)
      at com.assuredlabor.db.DatabaseMigrator.migrate(DatabaseMigrator.java:13)
      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:597)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1414)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1375)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1335)
      ... 62 more
  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 com.googlecode.flyway.core.util.jdbc.JdbcUtils.openConnection(JdbcUtils.java:50)
      ... 72 more
  Caused 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)
      ... 74 more
  </code></pre>
  
  <p>Any ideas would be appreciated.</p>