title: Exception in thread "main" org.hibernate.exception.GenericJDBCException: Cannot open connection
body: <p>I am trying to run a simple java project to see the working of hibernate but when i am executing my code (StoreData.java) it gives a hibernate exception, i am using oracle 11g R2 and eclipse galileo , my oracle SID is "orcl" connection name is "mysql" username is "sys" password is "oracle". Here is the code: </p>
  
  <p>Employee.java:</p>
  
  <pre><code>    *package com.persist;
  public class Employee {
  
      private int id;
      private String firstName;
      private String lastName;
  
  
      public int getId() {
          return id;
      }
      public void setId(int id) {
          this.id = id;
      }
      public String getFirstName() {
          return firstName;
      }
      public void setFirstName(String firstName) {
          this.firstName = firstName;
      }
      public String getLastName() {
          return lastName;
      }
      public void setLastName(String lastName) {
          this.lastName = lastName;
      }
  
  
  }*
  </code></pre>
  
  <p><strong>employee.hbm.xml :</strong></p>
  
  <pre><code>    *&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;!DOCTYPE hibernate-mapping PUBLIC  
   "-//Hibernate/Hibernate Mapping DTD 3.0//EN"  
   "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"&gt; 
  
   &lt;hibernate-mapping&gt;
  
   &lt;class name="com.persist.Employee" table="Emp"&gt;
  
   &lt;id name="id"&gt;
   &lt;generator class="assigned"&gt;&lt;/generator&gt;
   &lt;/id&gt;
   &lt;property name="firstName"&gt;&lt;/property&gt;
   &lt;property name="lastName"&gt;&lt;/property&gt;
  
    &lt;/class&gt;
  
   &lt;/hibernate-mapping&gt;*
  </code></pre>
  
  <p><strong>hibernate.cfg.xml :</strong></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="hbm2ddl.auto"&gt;update&lt;/property&gt;
  &lt;property name="dialect"&gt;org.hibernate.dialect.Oracle9Dialect&lt;/property&gt;
  &lt;property name="connection.url"&gt;jdbc:oracle:thin:@localhost:1521:orcl&lt;/property&gt;
  &lt;property name="connection.username"&gt;sys&lt;/property&gt;
  &lt;property name="connectio.password"&gt;oracle&lt;/property&gt;
  &lt;property name="connection.driver_class"&gt;oracle.jdbc.driver.OracleDriver&lt;/property&gt;
  &lt;mapping  resource="employee.hbm.xml"/&gt;
  &lt;/session-factory&gt;
  &lt;/hibernate-configuration&gt;*
  </code></pre>
  
  <p><strong>StoreData.java :</strong></p>
  
  <pre><code>    *package com.DAO;
  import org.hibernate.Session;
  import org.hibernate.SessionFactory;
  import org.hibernate.Transaction;
  import org.hibernate.cfg.Configuration;
  import com.persist.Employee;
  public class StoreData {
      /**
       * @param args
       */
      public static void main(String[] args) {
          // TODO Auto-generated method stub
  
          Configuration cf = new Configuration();
          cf.configure("hibernate.cfg.xml");
  
          SessionFactory factory =cf.buildSessionFactory();
  
          Session session =factory.openSession();
  
           Transaction t =session.beginTransaction();
  
           Employee e = new Employee();
           e.setId(1);
           e.setFirstName("samar");
           e.setLastName("singh");
  
           session.persist(e);
  
           t.commit();
           session.close();
  
           System.out.println("successfully saved");
      }
  }*
  </code></pre>
  
  <p><strong>console:</strong></p>
  
  <pre><code>    *log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment).
  log4j:WARN Please initialize the log4j system properly.
  Exception in thread "main" org.hibernate.exception.GenericJDBCException: Cannot open connection
      at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103)
      at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91)
      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 com.DAO.StoreData.main(StoreData.java:27)
  Caused by: java.sql.SQLException: invalid arguments in call
      at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
      at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146)
      at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:208)
      at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:236)
      at oracle.jdbc.driver.PhysicalConnection.&lt;init&gt;(PhysicalConnection.java:414)
      at oracle.jdbc.driver.T4CConnection.&lt;init&gt;(T4CConnection.java:165)
      at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:35)
      at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:801)
      at java.sql.DriverManager.getConnection(Unknown Source)
      at java.sql.DriverManager.getConnection(Unknown Source)
      at org.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:110)
      at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:417)
      ... 5 more*
  </code></pre>
  
  <p><strong>project hierarchy :</strong></p>
  
  <p><img src="https://i.stack.imgur.com/UhynG.jpg" alt="hiber is my project name"></p>
  
  <p><img src="https://i.stack.imgur.com/O6don.jpg" alt="included jar files"></p>