servicenow.community.sql
Class DatabaseWriter

java.lang.Object
  extended by servicenow.community.sql.DatabaseWriter

public class DatabaseWriter
extends java.lang.Object

Contains the JDBC connection for an SQL database.

Author:
LewisGF

Constructor Summary
DatabaseWriter(java.util.Properties props)
           
 
Method Summary
 boolean autocreate()
           
 void commit()
           
 java.sql.Connection connection()
           
 void executeStatement(java.lang.String sqlCommand)
           
 java.sql.Connection initialize()
          Connect to the database.
 SqlGenerator sqlGenerator()
           
 TableWriter tableWriter(GlideTable glidetable)
           
 TableWriter tableWriter(GlideTable glidetable, java.lang.String sqlTableName, Metrics metrics)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DatabaseWriter

public DatabaseWriter(java.util.Properties props)
               throws PumperException,
                      java.io.IOException,
                      org.jdom2.JDOMException,
                      java.sql.SQLException
Throws:
PumperException
java.io.IOException
org.jdom2.JDOMException
java.sql.SQLException
Method Detail

initialize

public java.sql.Connection initialize()
                               throws java.sql.SQLException
Connect to the database. Set the timezone to GMT. Set the date format to YYYY-MM-DD

Throws:
java.sql.SQLException

connection

public java.sql.Connection connection()

commit

public void commit()
            throws java.sql.SQLException
Throws:
java.sql.SQLException

sqlGenerator

public SqlGenerator sqlGenerator()

autocreate

public boolean autocreate()

tableWriter

public TableWriter tableWriter(GlideTable glidetable)
                        throws java.sql.SQLException,
                               PumperException,
                               java.io.IOException,
                               org.jdom2.JDOMException
Throws:
java.sql.SQLException
PumperException
java.io.IOException
org.jdom2.JDOMException

tableWriter

public TableWriter tableWriter(GlideTable glidetable,
                               java.lang.String sqlTableName,
                               Metrics metrics)
                        throws java.sql.SQLException,
                               PumperException,
                               java.io.IOException,
                               org.jdom2.JDOMException
Throws:
java.sql.SQLException
PumperException
java.io.IOException
org.jdom2.JDOMException

executeStatement

public void executeStatement(java.lang.String sqlCommand)
                      throws java.sql.SQLException
Throws:
java.sql.SQLException