title: how to work with iBatis
body: <p>I am so new in ibatis. I have read some feature on it and tried to work but it's not happening for me. May be I am facing placement problem here for xml files. Here is my work flow >>> I have taken a project in netbeans and keep ibatis-2.3.4.726.jar under Libraries package with Mysql JDBC Driver. Then I have created Employee.xml and SqlMapConfig.xml files and keep them under Web Pages/WEB-INF package. Then I have created Employee.java and IbatisInsert.java files and keep them under source packages/default-package folder. Now when I run IbatisInsert.java file it shows the following messages >>></p>
  
  <blockquote>
    <p>Exception in thread "main" java.io.IOException: Could not find resource SqlMapConfig.xml
        at com.ibatis.common.resources.Resources.getResourceAsStream(Resources.java:110)
        at com.ibatis.common.resources.Resources.getResourceAsStream(Resources.java:95)
        at com.ibatis.common.resources.Resources.getResourceAsReader(Resources.java:161)
        at IbatisInsert.main(IbatisInsert.java:20)</p>
  </blockquote>
  
  <p>I am not understanding where to keep files and how to configure ibatis. I have searched google but not understanding. Can anyone please help me on this please ??!!! here are my xml files and java files belows :::</p>
  
  <p>employee.xml >>></p>
  
  <pre><code> &lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;!DOCTYPE sqlMap 
  PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN"
  "http://ibatis.apache.org/dtd/sql-map-2.dtd"&gt;
  
  &lt;sqlMap namespace="Employee"&gt; 
  &lt;insert id="insert" parameterClass="Employee"&gt;
  
     insert into EMPLOYEE(first_name, last_name, salary)
     values (#first_name#, #last_name#, #salary#)
  
     &lt;selectKey resultClass="int" keyProperty="id"&gt;
        select last_insert_id() as id
     &lt;/selectKey&gt;
  
  &lt;/insert&gt; 
  
  &lt;/sqlMap&gt;
  </code></pre>
  
  <p>SqlMapConfig.xml   >>></p>
  
  <pre><code>    &lt;!--&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;Context antiJARLocking="true" path="/ibatisExample"/&gt;--&gt;
  
  &lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;!DOCTYPE sqlMapConfig
  PUBLIC "-//ibatis.apache.org//DTD SQL Map Config 2.0//EN"
  "http://ibatis.apache.org/dtd/sql-map-config-2.dtd"&gt;
  
  &lt;sqlMapConfig&gt;
       &lt;settings useStatementNamespaces="true"/&gt;
       &lt;transactionManager type="JDBC"&gt;
          &lt;dataSource type="SIMPLE"&gt;
            &lt;property name="JDBC.Driver" 
                 value="com.mysql.jdbc.Driver"/&gt;
            &lt;property name="JDBC.ConnectionURL"
                 value="jdbc:mysql://localhost:3306/ibatisexample"/&gt;
            &lt;property name="JDBC.Username" value="root"/&gt;
            &lt;property name="JDBC.Password" value="123"/&gt;
          &lt;/dataSource&gt;
        &lt;/transactionManager&gt;
       &lt;sqlMap resource="Employee.xml"/&gt; 
  &lt;/sqlMapConfig&gt;
  
  &lt;property name="JDBC.AutoCommit" value="true"/&gt;
  
  &lt;property name="Pool.MaximumActiveConnections" value="10"/&gt;
  
  &lt;property name="Pool.MaximumIdleConnections" value="5"/&gt;
  
  &lt;property name="Pool.MaximumCheckoutTime" value="150000"/&gt; 
  
  &lt;property name="Pool.MaximumTimeToWait" value="500"/&gt; 
  
  &lt;property name="Pool.PingQuery" value="select 1 from Employee"/&gt; 
  
  &lt;property name="Pool.PingEnabled" value="false"/&gt;
  </code></pre>
  
  <p>employee.java >>></p>
  
  <pre><code> /*
   * To change this template, choose Tools | Templates
   * and open the template in the editor.
   */
  
  /**
   *
   * @author sumon.bappi
   */
  public class Employee {
    private int id;
    private String first_name; 
    private String last_name;   
    private int salary;  
  
    /* Define constructors for the Employee class. */
    public Employee() {}
  
    public Employee(String fname, String lname, int salary) {
      this.first_name = fname;
      this.last_name = lname;
      this.salary = salary;
    }
  } /* End of Employee */
  </code></pre>
  
  <p>IbatisInsert.java   >>></p>
  
  <pre><code>    /*
   * To change this template, choose Tools | Templates
   * and open the template in the editor.
   */
  
  /**
   *
   * @author sumon.bappi
   */
  import com.ibatis.common.resources.Resources;
  import com.ibatis.sqlmap.client.SqlMapClient;
  import com.ibatis.sqlmap.client.SqlMapClientBuilder;
  import java.io.*;
  import java.sql.SQLException;
  import java.util.*;
  
  public class IbatisInsert{
    public static void main(String[] args)
     throws IOException,SQLException{
     Reader rd = Resources.getResourceAsReader("SqlMapConfig.xml");
     SqlMapClient smc = SqlMapClientBuilder.buildSqlMapClient(rd);
  
     /* This would insert one record in Employee table. */
     System.out.println("Going to insert record.....");
     Employee em = new Employee("Zara", "Ali", 5000);
  
     smc.insert("Employee.insert", em);
  
     System.out.println("Record Inserted Successfully ");
  
    }
  } 
  </code></pre>
  
  <p>my file placement as like the following image >>></p>
  
  <p><img src="https://i.stack.imgur.com/uHuA3.png" alt="ibatis_file_placement"></p>