SQL Appender Configuration - FollettSchoolSolutions/perfmon4j GitHub Wiki
Version Introduced: 1.3.0
Class Name: org.perfmon4j.JDBCSQLAppender and org.perfmon4j.PooledSQLAppender
The SQLAppender is an abstract class implemented by one of two classes.
- JDBCSQLAppender allows you to configure a connection to the perfmon4j database using a jdbc driver.
- PooledSQLAppender allows you to connect to a JNDI registered connection pool.
The SQLAppender writes to the Perfmon4j database. For information on configuring the perfmon4j database see here
Example configuration(s):
<!-- JDBCSQLAppender example -->
<appender name='jdbc-example' className='org.perfmon4j.JDBCSQLAppender' interval='1 minute'>
<attribute name='driverPath'>c:\jdbcdriver\mssql-jdbc-7.2.1.jre8.jar</attribute>
<attribute name='driverClass'>com.microsoft.sqlserver.jdbc.SQLServerDriver</attribute>
<attribute name='jdbcURL'>jdbc:sqlserver://localhost;DatabaseName=perfmon4j</attribute>
<attribute name='dbSchema'>dbo</attribute>
<attribute name='userName'>perfmon4j</attribute>
<attribute name='password'>mypassword</attribute>
<attribute name='groups'>test, JDBC</attribute>
</appender>
<!-- PooledSQLAppender example -->
<appender name='pooled-example' className='org.perfmon4j.PooledSQLAppender' interval='1 minute'>
<attribute name='poolName'>MyConnectionPool</attribute>
<attribute name='groups'>test, Pooled</attribute>
</appender>
Common to both JDBCSQLAppender and PooledSQLAppender
Attribute | Description | Required | Notes |
---|---|---|---|
systemNameBody | If provided this will be the system name that associated with all observations of data written to the database. If not provided a system name will be generated using the computer name and a Hash Code generated using the current working directory of the running application. If provided this value should be unique and indicate a single running process. | No | Example of a default body: mysystemname_958164 |
systemNamePrefix | A prefix that will be prepended to the system name body | No | Example: "payment:" |
systemNameSuffix | A suffix that will be appended to the system name body | No | Example: ":mysuffix" |
excludeCWDHashFromSystemName | If true the default systemNameBody will not contain the hash for the current working directory | No | default = false |
groups | (Introduced in Version 1.3.4) This element allows you to group multiple systems together for reporting purposes. For example if you wanted to group all of your production systems and also group your payment systems together you might specify a value of "production, payment" | No | Examples: "production, payment" OR "test, payment" |
Attribute | Description | Required | Notes |
---|---|---|---|
driverPath | Fully qualified path indicating the location of a jar file containing the JDBC Driver | No** | Example:c:\jdbcdriver\mssql-jdbc-7.2.1.jre8.jar |
driverClass | The classname of the JDBCDriver | Yes | Examples: com.microsoft.sqlserver.jdbc.SQLServerDriver |
jdbcURL | The full JDBC connection string as defined by the specified JDBC Driver | Yes | Examples: jdbc:sqlserver://localhost;DatabaseName=perfmon4j |
dbSchema | The database schema name | No | Only required if the database connection requires explicit schema name |
userName | The user name for the database connection | Yes | |
password | The password for the database connection | Yes |
** Not required if your JDBCDriver is loaded into the classpath of the JVM.
Attribute | Description | Required | Notes |
---|---|---|---|
poolName | The JNDI Pool name | Yes |