Q: Getting Null for JDBC connection I am running tomcat 7.0.47 on my windows and there I am having the Mysql database connection to the data stored at BlueHost .When I run it locally it runs successully and makes conenction to the BlueHost database without any error .But when I try to deploy its war file at the linux environment running tomcat 7.0.42 it gives me following error:
org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null' 

Also , I have imported the tomcat.dbcp jar to the online server as linux has some issues with this jar .
Also, Server is working if I donot follow connection pooling approach .

I am not able to find out What can be the issue with  pooling ?
Following is my context.xml file:
  <Context antiJARLocking="true" path="/web_app">
   <Resource 
              name="jdbc/DB" 
              auth="Container" 
              type="javax.sql.DataSource" 
              maxActive="100" 
              maxIdle="30"  
              maxWait="10000"
              username="DBUser" 
              password="DBPassword"
              driverClassName="com.mysql.jdbc.Driver"
              url="jdbc:mysql://xx.xx.xx.xx:xx/DB_app?useUnicode=true&#38;characterEncoding=UTF-8"/>
     </Context>

web.xml:
<resource-ref>
    <description>MySQL Datasource</description>
    <res-ref-name>jdbc/DB</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
  </resource-ref>

DatabaseConnection.java:
 public class Get_Database_Connection 
{

     static DataSource ds;
     public static Connection con=null;
     public static Connection get_DB_Connection() throws NamingException,SQLException
     {
           if(ds==null)
            {

            Context ctx = new InitialContext();
            ds = (DataSource) ctx.lookup("java:comp/env/jdbc/DB");  

           return ds.getConnection();
          }
            else
            {
            return ds.getConnection();
            } 
    }
}


A: Based on Tomcat's JDBC Connection Pool to use connection pool you are required to configure factory attribute, so here is your updated context.xml configuration file:
<Context antiJARLocking="true" path="/web_app">
 <Resource name="jdbc/DB"
      auth="Container"
      type="javax.sql.DataSource"
      factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
      maxActive="100"
      maxIdle="30"
      maxWait="10000"
      username="yourUsername"
      password="password"
      driverClassName="com.mysql.jdbc.Driver"
      url="jdbc:mysql://xx.xx.xx.xx:xx/DB_app?useUnicode=true&#38;characterEncoding=UTF-8"/>
</Context>

