Skip to end of metadata
Go to start of metadata

Based on the sampleConnection example, the method of integrating with Altibasein iBATIS is explained in detail.

Note: IDE uses Eclipse.

Creating DB Tables and Sequences

The following tables and sequences are created in the DB. (Refer to create_tbl.sql file)

Creating Project

Create a project called SimpleConnection in Eclipse.

  1. Click Menu-File-Java Project

  2. Project name: Enter SimpleConnection

  3. Click the Finish button

Creating SqlMap File

Create a SqlMap file that defines CRUD SQL statement of the Person table and methods to be mapped (Person.xml).

  1. Right-click on the SimpleConnection project-src directory and click New-File.

  2. Create Person.xml in File name:.

Write the following in the Person.xml file.

SQL matching the ID defined in <insert>, <update>, <delete>, and <select> tags defined in the above file when calling insert, update, delete, queryForXXX () method of SqlMapClient in the application are automatically executed.

Creating SqlMapConfig File

  1. Create a properties file (db.properties) that defines properties for Altibase connection. (Right-click on SimpleConnection project-src directory and click New-File. Create db.properties in File name :)

 

2. Set the dataSource and SqlMap files for interworking with Altibase in the SqlMapConfig file (SqlMapConfigExample.xml). (Right-click on the SimpleConnection project-src directory and click New-File. Create SqlMapConfigExample.xml in File name:)

Creating Application

  1. Create a Person class (Person.java) that is a DO object for the person table.

  2. Right-click in the src directory of the SimpleConnection project and click New-Class.

  3. Enter examples.domain in Package: and Person in Name:

 

Write the following in the Person.java file.

3. Write a main program (PersonApp.java) that executes CRUD in the DB.

4. Right-click in the src directory of the SimpleConnection project and click New-Class.

 5. Enter PersonApp in Name :.

 

Write the following in the PersonApp.java file.

Adding Related JAR Files

Add the Altibase.jar and ibatis-2.3.4.x.jar files.

Right-click on SimpleConnection project, click Properties-Java Build Path-Click Add External JARS in Libraries to add Altibase.jar and ibatis-2.3.4.x.jar files.

Running Application

Run the SimpleConnection project.

After clicking the SimpleConnection project, run from the menu or click the Run button.

 

 

 


  • No labels