Data import / export processing can be done by command line operation.

The following command is included in the bin folder of the built application wagbyapp.These are provided as executable scripts.

Command (script) name Use argument Application example
init_db Initializing the table Model name (English) init_db.bat
init_db.bat staff
drop_db Delete table definition Model name (English) drop_db.bat
drop_db.bat staff
export_db Exporting data Export target folder export_db.bat ..\..\export\YOURFORLDER
import_db Create tables and import data (*) Import target folder import_db.bat ..\..\export\YOURFORLDER
Import_db also creates a table at the same time.Therefore, if import_db is used, init_db is unnecessary.
When using Windows OS, this batch file can not be executed by double clicking (from File Explorer).This is because you need to specify "target folder" as a command line argument.

Current folder when executing command

Each command is provided in the wagbyapp \ bin folder. When executing the command, please set the current folder to wagbyapp \ bin.

For Windows OS, use the cd command from the command prompt to move the current folder.

cd $(wagbyappフォルダ)\bin

The init_db command initializes the table. Specifically, we will import the data contained in the wagbyapp \ webapps \ wagby \ WEB - INF \ export \ init folder.

This command skips processing if the table already exists. Therefore, normally, first execute the drop_db command and then execute the init_db command.

Execution method

For Windows OS:


For Linux OS:
If execute permission is not given to sh script, please grant execute right with OS command beforehand.(The operation method is omitted.Please read the command explanation of the Linux OS separately.)

Specify the target model

You can specify a model ID as a command line argument.

init_db staff
If model ID is omitted, all models are eligible.

Specify multiple models

Separate multiple model IDs with spaces.

init_db juser customer jgroup
As of R7.12, a format enclosing the model name entry in double quotes has become available.Example init_db "juser customer jgroup"

The drop_db command deletes the table. Specifically, execute the drop table command on the database.

Execution method

For Windows OS:


For Linux OS:

Specify the target model

You can specify a model ID as a command line argument.Separate multiple model IDs with spaces.

init_db staff
If model ID is omitted, all models are eligible.

The export_db command outputs the contents of the table in an XML format file.

export_db.bat [出力先フォルダ]

The destination folder can be omitted.The default folder name is ".. \ .. \ export \ data _" output time (year, month, day, hour, minute, second) "".

The import_db command creates the table and reads the exported XML format file and stores it in the database.

import_db.bat [読み込むデータが格納されているフォルダ]

Input example

import_db.bat ..\..\export\data_sample

If there is a large amount of target data, an error of "Out Of Memory" (insufficient memory) may occur due to insufficient standard memory size. In this case, edit the script file with a text editor.Please correct the following diagonal part.

"%JAVA_HOME%\bin\java" -Xmx512m -XX:MaxPermSize=192m -Dcatalina.home="..""${catalina.home}\temp" -jar InitLoader.jar auto %TARGET% -check_exists_table true -c ..\webapps\wagby\WEB-INF\export\conf\initdb.xml  -d ..\webapps\wagby\WEB-INF\export

The initial value of -Xmx is 512 m (512 Mbyte).Increase this value to make it a successful value.

Wagby's import/export processing treats "one XML file" as "(one record) (database)" and exchanges with the database.

The concrete XML file is as follows.

<?xml version="1.0" encoding="UTF-8"?>
  <name>山田 花子</name>
The XML element name is "Repository" Model ID "and" Item ID "is used.

Notes on editing XML files

When editing an XML file,"Notepad" included with Windows can not be usedSo please be careful.

The character encoding of the XML file that Wagby reads is UTF - 8, and should not include byte order mark (BOM).Notepad is designed to always give a byte order mark (BOM) when saving a file written in UTF - 8.For this reason, an XML file edited and saved in Notepad becomes an error when processing with Wagby.

When using the built-in database, stop the wagbyapp application and execute the command (introduced here).