JDBC Handler
The JDBCHandler will write the log request to a database. In order to achieve flexibility this handler works like the
DefinedFormatter. You have to define the insert statement. There is no table name or anything required. The syntax of the definition looks like this:
insert into table_name (field_a,field_b) values('token_a','token_b')
The table_name defines the name of the table that should be used. Next are the fields that should be used.
Note: currently all values will be saved as string so these fields must be of type
varcharThen you need to define the tokens that will be inserted. See
DefinedFormatter for a description of the tokens. It is important that you wrap every token with '' because the tokens can generate an output that might contain spaces. Therefore you need to escape the tokens.
Example
Here is an example about how to configure the JDBCHandler:
<generator name="TestGenerator">
<handler class="JDBCHandler">
<parameter name="sql" value="insert into log (date,target,text) values('${date}','${target}','${text}')"/>
<parameter name="user" value="admin"/>
<parameter name="password" value="root"/>
<parameter name="url" value="jdbc:mysql://localhost/test"/>
<parameter name="driver" value="com.mysql.jdbc.Driver"/>
</handler>
</generator>