title: Loaded JDBC MySQL Driver but failed to connect to MySQL via Spring config
body: <p>While connecting to MySQL DB using JDBC Driver Manager, the connection is successfully and retrieves the results set as expected. But when trying to connect via Spring configuration using either org.springframework.jdbc.datasource.DriverManagerDataSource or 
  org.springframework.jdbc.datasource.SimpleDriverDataSource</p>
  
  <p>The JDBC driver com.mysql.jdbc.Driver gets loaded but fails to make a connection with MySQL.</p>
  
  <p>Test Application Class:
      package com.xxxx.xxxx.xxxx;</p>
  
  <pre><code>import com.xxxx.xxxx.xxxx.dao.TimeslotDAO;
  import org.springframework.context.ApplicationContext;
  import org.springframework.context.support.ClassPathXmlApplicationContext;
  
  import java.sql.Connection;
  import java.sql.DriverManager;
  import java.sql.PreparedStatement;
  import java.sql.ResultSet;
  
  public class App {
  
      public static void main(String[] args) {
          //testClassic(); // This works and gets the results.
          testSpring();  // Fails with SQLException.
      }
  
      private static void testSpring(){
          ApplicationContext ctx = new ClassPathXmlApplicationContext("Spring-Module.xml");
          TimeslotDAO timeSlot = (TimeslotDAO) ctx.getBean("timeslotDAO");
          timeSlot.populateTimeSlotsCache();
      }
  
      private static void testClassic(){
          try{
              Class.forName("com.mysql.jdbc.Driver");
          }catch(Exception e){
              e.printStackTrace();
          }
          try {
              Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/FR", "root", "xxxx");
              if(conn!=null) {
                  String sql = "select * from TB_AUTO_xxx_SLOT_xxx " +
                          "where i_book_id =2639";
                  PreparedStatement stmt =  conn.prepareStatement(sql);
                  ResultSet rs = stmt.executeQuery();
                  while(rs.next()){
                      System.out.println(rs.getLong(1));
                  }
                  if(rs!=null) rs.close();
                  if(stmt!=null)stmt.close();
                  if(conn!=null)conn.close();
              }
          }catch(Exception e){
              e.printStackTrace();
          }
  
      }
  }
  </code></pre>
  
  <p>Spring Configuration of DataSource:</p>
  
  <pre><code>&lt;bean id="dataSource" class="org.springframework.jdbc.datasource.SimpleDriverDataSource"&gt;
        &lt;property name="driverClassName" value="com.mysql.jdbc.Driver"/&gt;
         &lt;property name="url" value="jdbc:msql://localhost:3306/FR" /&gt;
         &lt;property name="username" value="root"/&gt;
         &lt;property name="password" value="xxxx"/&gt;
  
  &lt;/bean&gt;
  </code></pre>
  
  <p>Exception in Log:</p>
  
  <pre><code>INFO: Loaded JDBC driver: com.mysql.jdbc.Driver
  java.sql.SQLException: No suitable driver found for jdbc:msql://localhost:3306/FR
      at java.sql.DriverManager.getConnection(DriverManager.java:689)
      at java.sql.DriverManager.getConnection(DriverManager.java:208)
      at org.springframework.jdbc.datasource.DriverManagerDataSource.getConnectionFromDriverManager(DriverManagerDataSource.java:174)
      at org.springframework.jdbc.datasource.DriverManagerDataSource.getConnectionFromDriver(DriverManagerDataSource.java:165)
      at org.springframework.jdbc.datasource.AbstractDriverBasedDataSource.getConnectionFromDriver(AbstractDriverBasedDataSource.java:149)
      at org.springframework.jdbc.datasource.AbstractDriverBasedDataSource.getConnection(AbstractDriverBasedDataSource.java:119)
      at com.xxxx.xxxx.xxxx.dao.impl.TimeslotDAOImpl.populateTimeSlotsCache(TimeslotDAOImpl.java:23)
      at com.xxxx.xxxx.xxxx.App.testSpring(App.java:22)
      at com.xxxx.xxxx.xxxx.App.main(App.java:16)
  </code></pre>