org.hibernate.exception.JDBCConnectionException: Cannot open connection
<p>for testing purpose i wrote  very small code,which repeatedly throws exception related to jdbc driver.</p>

<pre><code>   package sally;

   import org.hibernate.Session;
   import org.hibernate.Transaction;

   public class MainClass {

   public static void main(String args[]){

    try{
        Session session=HibernateUtil.getSession();
        Transaction tx=session.beginTransaction();
        Employee ee=new Employee("abx","asd",2000);
        session.save(ee);
        tx.commit();


    }catch(Exception e){
        e.printStackTrace();
    }
  }
}
</code></pre>

<p>This is my ben/pojo class for mapping</p>

<pre><code>package sally;

   public class Employee {
   private int id;
   private String firstName; 
   private String lastName;   
   private int salary;  

  public Employee() {}
  public Employee(String fname, String lname, int salary) {
  this.firstName = fname;
  this.lastName = lname;
  this.salary = salary;
  }
   public int getId() {
   return id;
 }
  public void setId( int id ) {
   this.id = id;
 }
  public String getFirstName() {
  return firstName;
  }
      public void setFirstName( String first_name ) {
      this.firstName = first_name;
      }
      public String getLastName() {
      return lastName;
       }
      public void setLastName( String last_name ) {
      this.lastName = last_name;
      }
        public int getSalary() {
        return salary;
      }
        public void setSalary( int salary ) {
        this.salary = salary;
      }
}


  &lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;!DOCTYPE hibernate-mapping PUBLIC 
   "-//Hibernate/Hibernate Mapping DTD//EN"
   "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"&gt; 

 &lt;hibernate-mapping&gt;
   &lt;class name="sally.Employee" table="EMPLOYEE"&gt;
     &lt;meta attribute="class-description"&gt;
     This class contains the employee detail. 
     &lt;/meta&gt;
     &lt;id name="id" type="int" column="id"&gt;
      &lt;generator class="native"/&gt;
     &lt;/id&gt;
    &lt;property name="firstName" column="first_name" type="string"/&gt;
    &lt;property name="lastName" column="last_name" type="string"/&gt;
    &lt;property name="salary" column="salary" type="int"/&gt;
  &lt;/class&gt;
  &lt;/hibernate-mapping&gt;
</code></pre>

<p>and this is cfg file for pojo class:</p>

<pre><code>  &lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;!DOCTYPE hibernate-configuration PUBLIC 
   "-//Hibernate/Hibernate Configuration DTD 3.0//EN" 
    "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"&gt;
  &lt;hibernate-configuration&gt;
     &lt;session-factory&gt;
       &lt;property       name="hibernate.connection.driver_class"&gt;com.mysql.jdbc.Driver&lt;/property&gt;
    &lt;property    name="hibernate.connection.url"&gt;jdbc:mysql://localhost:3306/test&lt;/property&gt;
    &lt;property name="hibernate.connection.password"&gt;&lt;/property&gt;
    &lt;property name="hibernate.connection.username"&gt;root&lt;/property&gt;
    &lt;property name="hibernate.dialect"&gt;org.hibernate.dialect.MySQLDialect&lt;/property&gt;
    &lt;property name="show_sql"&gt;true&lt;/property&gt;


    &lt;mapping class="sally.Employee"&gt;&lt;/mapping&gt;
&lt;/session-factory&gt;
</code></pre>

<p></p>

<p>but every time i am running the code it throws exxception :</p>

<pre><code>log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
org.hibernate.exception.JDBCConnectionException: Cannot open connection
    at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:74)
    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 sally.MainClass.main(MainClass.java:12)
Caused by: java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/test
    at java.sql.DriverManager.getConnection(DriverManager.java:596)
    at java.sql.DriverManager.getConnection(DriverManager.java:187)
    at org.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:110)
    at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:417)
    ... 5 more
</code></pre>

<p>can any body tell whats wrong here???</p>

<p>this is db column list : first_name last_name salary.</p>