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)
Create a project called SimpleConnection in Eclipse.
Click Menu-File-Java Project
Project name: Enter SimpleConnection
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).
Right-click on the SimpleConnection project-src directory and click New-File.
Create Person.xml in File name:.
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
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:)
Create a Person class (Person.java) that is a DO object for the person table.
Right-click in the src directory of the SimpleConnection project and click New-Class.
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.
Run the SimpleConnection project.
After clicking the SimpleConnection project, run from the menu or click the Run button.