Class JSLDatabase


  • public class JSLDatabase
    extends java.lang.Object
    A database that represents the statistical output from simulation runs. See the file JSLDb.sql in the dbScripts directory for the structure of the database. Assumes that a schema called getJSLSchemaName() exists in the database.

    If the supplied database does not have a schema called getJSLSchemaName(), then the schema is created and the appropriate JSL related database artifacts are installed in the schema. If a schema called getJSLSchemaName() already exists in the database, then the assumption is that the schema is appropriately configured to hold JSL related database artifacts. The default schema of the database is set to getJSLSchemaName().

    • Field Detail

      • dbDir

        public static final java.nio.file.Path dbDir
      • dbScriptsDir

        public static final java.nio.file.Path dbScriptsDir
    • Constructor Detail

      • JSLDatabase

        public JSLDatabase​(DatabaseIfc database)
        Creates an instance of a JSLDatabase. Assumes that a schema called getJSLSchemaName() exists in the database. If the supplied database does not have a schema called getJSLSchemaName(), then the schema is created and the appropriate JSL related database artifacts are installed in the schema. If a schema called getJSLSchemaName() already exists in the database, then the assumption is that the schema is appropriately configured to hold JSL related database artifacts. The default schema of the database is set to getJSLSchemaName()

        The clear database option is false.

        Parameters:
        database - the database to use for setting up the JSLDatabase, must not be null
      • JSLDatabase

        public JSLDatabase​(DatabaseIfc database,
                           boolean clearDataOption)
        Creates an instance of a JSLDatabase. Assumes that a schema called getJSLSchemaName() exists in the database. If the supplied database does not have a schema called getJSLSchemaName(), then the schema is created and the appropriate JSL related database artifacts are installed in the schema. If a schema called getJSLSchemaName() already exists in the database, then the assumption is that the schema is appropriately configured to hold JSL related database artifacts. The default schema of the database is set to getJSLSchemaName().
        Parameters:
        database - the database to use for setting up the JSLDatabase, must not be null
        clearDataOption - whether or not the database will be cleared of all simulation related data upon construction
    • Method Detail

      • createEmbeddedDerbyDatabaseWithJSLSchema

        public static DatabaseIfc createEmbeddedDerbyDatabaseWithJSLSchema​(java.lang.String dbName)
        Creates an embedded Derby database with the name and in the db directory that has the JSL_DB schema. If the database already exists it is deleted and recreated.
        Parameters:
        dbName - the name must not be null
        Returns:
        a database that has the JSL schema
      • createEmbeddedDerbyDatabaseWithJSLSchema

        public static DatabaseIfc createEmbeddedDerbyDatabaseWithJSLSchema​(java.lang.String dbName,
                                                                           java.nio.file.Path dbDirectory)
        Creates an embedded Derby database with the name and in the supplied directory that has the JSL_DB schema. If the database already exists it is deleted and recreated.
        Parameters:
        dbName - the name must not be null
        dbDirectory - the path to the database directory
        Returns:
        a database that has the JSL schema
      • createEmbeddedDerbyJSLDatabase

        public static JSLDatabase createEmbeddedDerbyJSLDatabase​(java.lang.String dbName)
        Creates an embedded Derby database with the name and in the db directory that has the JSL_DB schema. If the database already exists it is deleted and recreated.
        Parameters:
        dbName - the name must not be null
        Returns:
        a a JSLDatabase instance
      • createEmbeddedDerbyJSLDatabase

        public static JSLDatabase createEmbeddedDerbyJSLDatabase​(java.lang.String dbName,
                                                                 java.nio.file.Path dbDirectory)
        Creates an embedded Derby database with the name and in the supplied directory that has the JSL_DB schema. If the database already exists it is deleted and recreated.
        Parameters:
        dbName - the name must not be null
        dbDirectory - the path to the database directory
        Returns:
        a JSLDatabase instance
      • executeJSLDbCreationScriptOnDatabase

        public static void executeJSLDbCreationScriptOnDatabase​(DatabaseIfc db)
        Executes the JSL database creation script on the database if the database does not already have a JSL_DB schema. If the database already contains a JSL_DB schema then the creation script is not executed.
        Parameters:
        db - the database, must not be null
      • getPostgresLocalHostJSLDatabase

        public static JSLDatabase getPostgresLocalHostJSLDatabase​(java.lang.String dbName,
                                                                  java.lang.String user,
                                                                  java.lang.String pWord)
        Creates a reference to a JSLDatabase. This method assumes that the data source has a properly configured JSL schema. If it does not, one is created. If it has one the data from previous simulation experiments are not deleted.
        Parameters:
        dbName - the name of the database, must not be null
        user - the user, must not be null
        pWord - the password, must not be null
        Returns:
        a fresh new JSLDatabase
      • getPostgresLocalHostJSLDatabase

        public static JSLDatabase getPostgresLocalHostJSLDatabase​(boolean clearDataOption,
                                                                  java.lang.String dbName,
                                                                  java.lang.String user,
                                                                  java.lang.String pWord)
        Creates a reference to a JSLDatabase. This method assumes that the data source has a properly configured JSL schema. If it does not, one is created. If it has one the data from previous simulations remains. If the clear data option is set to true then the data WILL be deleted immediately
        Parameters:
        clearDataOption - whether or not the data will be cleared when the JSLDatabase instance is created.
        dbName - the name of the database, must not be null
        user - the user
        pWord - the password
        Returns:
        a fresh new JSLDatabase
      • getPostgresJSLDatabase

        public static JSLDatabase getPostgresJSLDatabase​(boolean clearDataOption,
                                                         java.lang.String dbServerName,
                                                         java.lang.String dbName,
                                                         java.lang.String user,
                                                         java.lang.String pWord)
        Creates a reference to a JSLDatabase. This method assumes that the data source has a properly configured JSL schema. If it does not, one is created. If it has one the data from previous simulations remains. If the clear data option is set to true then the data WILL be deleted immediately.
        Parameters:
        clearDataOption - whether or not the data will be deleted when the JSLDatabase instance is created
        dbServerName - the name of the database server, must not be null
        dbName - the name of the database, must not be null
        user - the user
        pWord - the password
        Returns:
        a fresh new JSLDatabase
      • getJSLDatabase

        public static JSLDatabase getJSLDatabase​(java.util.Properties dBProperties,
                                                 org.jooq.SQLDialect sqlDialect)
        Creates a reference to a JSLDatabase. This method assumes that the data source has a properly configured JSL schema. If it does not, one is created. If it has one the data from previous simulation runs is not deleted.
        Parameters:
        dBProperties - appropriately configured HikariCP datasource properties
        sqlDialect - the jooq dialect for the database. It must match the database type in the properties
        Returns:
        a reference to JSLDatabase
      • getJSLDatabase

        public static JSLDatabase getJSLDatabase​(boolean clearDataOption,
                                                 java.util.Properties dBProperties,
                                                 org.jooq.SQLDialect sqlDialect)
        Creates a reference to a JSLDatabase. This method assumes that the data source has a properly configured JSL schema. If it does not, one is created. If it has one the data from previous simulation runs will be deleted if the clear data option is true. The deletion occurs immediately if configured as true.
        Parameters:
        clearDataOption - whether or not the data will be cleared of prior experiments when created
        dBProperties - appropriately configured HikariCP datasource properties
        sqlDialect - the jooq dialect for the database. It must match the database type in the properties
        Returns:
        a reference to a JSLDatabase
      • getJSLSchemaName

        public static java.lang.String getJSLSchemaName()
        Returns:
        the name of the schema that holds JSL database artifacts
      • getJSLTableNames

        public static java.util.List<java.lang.String> getJSLTableNames()
        Returns:
        the names of the tables in the JSL database as strings
      • getJSLViewNames

        public static java.util.List<java.lang.String> getJSLViewNames()
        Returns:
        the names of the views in the JSL database as strings
      • dropJSLDbSchema

        public static void dropJSLDbSchema​(Database db)
        Drops the getJSLSchemaName() schema and any related tables in the supplied database if they exist. If the database does not contain a schema called getJSLSchemaName(), then nothing happens
        Parameters:
        db - the database to do the dropping action
      • beforeExperiment

        protected void beforeExperiment​(Simulation simulation)
        Called by the JSLDatabaseObserver before the simulation experiment is run
        Parameters:
        simulation - the simulation
      • afterReplication

        protected void afterReplication​(Simulation simulation)
        Called by JSLDatabaseObserver after the simulation experiment replication is run
        Parameters:
        simulation - the simulation
      • afterExperiment

        protected void afterExperiment​(Simulation simulation)
        Called by JSLDatabaseObserver after the simulation experiment is run
        Parameters:
        simulation - the simulation
      • insertSimulationRunRecord

        protected void insertSimulationRunRecord​(Simulation sim)
        Inserts a new SimulationRecord into the database
        Parameters:
        sim - the simulation to insert a run for
      • finalizeCurrentSimulationRunRecord

        protected void finalizeCurrentSimulationRunRecord​(Simulation sim)
        Finalizes the current simulation record after the run is completed
        Parameters:
        sim - the current simulation
      • insertModelElements

        protected void insertModelElements​(java.util.List<ModelElement> elements)
        The list must be ordered according to parent-child, so that parents occur before their children in the list
        Parameters:
        elements - the list of elements to add
      • newModelElementRecord

        protected ModelElementRecord newModelElementRecord​(ModelElement modelElement,
                                                           java.lang.Integer simId)
        Creates a new ModelElementRecord for the database
        Parameters:
        modelElement - the model element to get data from
        simId - the simulation id
        Returns:
        the created record
      • insertWithinRepResponses

        protected void insertWithinRepResponses​(java.util.List<ResponseVariable> responses)
        Inserts within replication statistics for the supplied response variables
        Parameters:
        responses - the list of ResponseVariables to insert for, must not be null
      • newWithinRepStatRecord

        protected WithinRepStatRecord newWithinRepStatRecord​(ResponseVariable rv,
                                                             java.lang.Integer simId)
        Creates a new WithinRepStatRecord
        Parameters:
        rv - the response variable to get data from
        simId - the simulation id
        Returns:
        the created record
      • insertWithinRepCounters

        protected void insertWithinRepCounters​(java.util.List<Counter> counters)
        Inserts within replication statistics for the supplied counters
        Parameters:
        counters - the list of Counter to insert for, must not be null
      • newWithinRepCounterStatRecord

        protected WithinRepCounterStatRecord newWithinRepCounterStatRecord​(Counter counter,
                                                                           java.lang.Integer simId)
        Creates a WithinCounterStatRecord
        Parameters:
        counter - the counter to create from
        simId - the simulation id
        Returns:
        the created record
      • insertAcrossRepResponses

        protected void insertAcrossRepResponses​(java.util.List<ResponseVariable> responses)
        Inserts across replication statistics for the supplied response variables
        Parameters:
        responses - the list of ResponseVariables to insert for, must not be null
      • insertAcrossRepResponsesForCounters

        protected void insertAcrossRepResponsesForCounters​(java.util.List<Counter> counters)
        Inserts across replication statistics for the supplied response variables
        Parameters:
        counters - the list of ResponseVariables to insert for, must not be null
      • newAcrossRepStatRecord

        protected AcrossRepStatRecord newAcrossRepStatRecord​(ModelElement modelElement,
                                                             java.lang.Integer simId,
                                                             StatisticAccessorIfc s)
        Creates an AcrossRepStatRecord into the database
        Parameters:
        modelElement - the model element name
        simId - the id of the simulation run
        s - that statistics to insert
        Returns:
        the created record
      • insertResponseVariableBatchStatistics

        protected void insertResponseVariableBatchStatistics​(java.util.Map<ResponseVariable,​BatchStatistic> bmap)
        Inserts batch statistics for the supplied map of response variables
        Parameters:
        bmap - the map of ResponseVariables to insert for, must not be null
      • insertTimeWeightedBatchStatistics

        protected void insertTimeWeightedBatchStatistics​(java.util.Map<TimeWeighted,​BatchStatistic> bmap)
        Inserts batch statistics for the supplied map of response variables
        Parameters:
        bmap - the map of ResponseVariables to insert for, must not be null
      • newBatchStatRecord

        protected BatchStatRecord newBatchStatRecord​(ResponseVariable rv,
                                                     java.lang.Integer simId,
                                                     BatchStatistic s)
        Creates an BatchStatRecord into the database
        Parameters:
        rv - the response variable, must not be null
        simId - the id of the simulation run
        s - that statistics to insert
        Returns:
        the created record
      • getCurrentSimRunRecordId

        public java.util.Optional<java.lang.Integer> getCurrentSimRunRecordId()
        Returns:
        the current simulation run record id, the last inserted simulation run
      • getCurrentSimRunRecord

        public java.util.Optional<SimulationRunRecord> getCurrentSimRunRecord()
        Returns:
        the current simulation run record or null
      • clearAllData

        public final void clearAllData()
        Clears all data from the JSL database. Keeps the database structure.
      • clearSimulationData

        public final void clearSimulationData​(Simulation simulation)
        Deletes all simulation data associated with the supplied simulation. In other words, the simulation run data associated with a simulation with the name and the experiment with the name.
        Parameters:
        simulation - the simulation to clear data from the database for
      • deleteSimulationRunRecord

        public final void deleteSimulationRunRecord​(java.lang.String simName,
                                                    java.lang.String expName)
        The combination of simName and expName should be unique within the database. Many different experiments can be run with different names for the same simulation. This method deletes the simulation run record with the provided names AND all related data associated with that simulation run. If a SIMULATION_RUN record does not exist with the simName and expName combination, nothing occurs.
        Parameters:
        simName - the name of the simulation
        expName - the experiment name for the simulation
      • getSimulationRunRecord

        public final SimulationRunRecord getSimulationRunRecord​(java.lang.String simName,
                                                                java.lang.String expName)
        The combination of simName and expName should be unique within the database. Many different experiments can be run with different names for the same simulation. This method gets the simulation run record with the provided names. If a SIMULATION_RUN record does not exist with the simName and expName combination, null is returned.
        Parameters:
        simName - the name of the simulation
        expName - the experiment name for the simulation
        Returns:
        the record or null
      • simulationRunRecordExists

        public final boolean simulationRunRecordExists​(java.lang.String simName,
                                                       java.lang.String expName)
        The combination of simName and expName should be unique within the database. Many different experiments can be run with different names for the same simulation. This method checks if the simulation run record with the provided names exists.
        Parameters:
        simName - the name of the simulation
        expName - the experiment name for the simulation
        Returns:
        true if the record exits
      • getSimulationRunRecord

        public final SimulationRunRecord getSimulationRunRecord​(java.lang.Integer simId)
        Parameters:
        simId - the identifier of the simulation record
        Returns:
        the record or null
      • getSimulationRunRecords

        public final org.jooq.Result<SimulationRunRecord> getSimulationRunRecords()
        Returns:
        the simulation run records as a jooq Result
      • getModelElementRecords

        public final org.jooq.Result<ModelElementRecord> getModelElementRecords()
        Returns:
        the model element records as a jooq Result
      • getModelElementRecordBiMap

        public final com.google.common.collect.BiMap<ModelElementRecord,​ModelElement> getModelElementRecordBiMap​(Model model)
        Parameters:
        model - the model, must not be null
        Returns:
        a BiMap linking model element records with corresponding ModelElements
      • getWithinRepStatRecords

        public final org.jooq.Result<WithinRepStatRecord> getWithinRepStatRecords()
        Returns:
        the within replication statistics as a jooq Result
      • getWithinRepStatRecordsAsResultSet

        public final java.sql.ResultSet getWithinRepStatRecordsAsResultSet()
        Returns:
        the within replication statistics as a JDBC ResultSet
      • getAcrossRepStatRecords

        public final org.jooq.Result<AcrossRepStatRecord> getAcrossRepStatRecords()
        Returns:
        a jooq Result of across replication statistics for all simulation runs
      • getAcrossRepStatRecordsAsResultSet

        public final java.sql.ResultSet getAcrossRepStatRecordsAsResultSet()
        Returns:
        the across replication statistics as a JDBC ResultSet
      • getBatchStatRecords

        public final org.jooq.Result<BatchStatRecord> getBatchStatRecords()
        Returns:
        a jooq Result of batch statistics
      • getBatchStatRecordsAsResultSet

        public final java.sql.ResultSet getBatchStatRecordsAsResultSet()
        Returns:
        the batch statistics as a JDBC ResultSet
      • getWithinRepResponseViewRecords

        public final org.jooq.Result<WithinRepResponseViewRecord> getWithinRepResponseViewRecords()
        Within replication view of that simulation response results
        Returns:
        a jooq Result holding (simid, exp_name, element_name, stat_name, rep_num, average)
      • getWithinRepCounterViewRecords

        public final org.jooq.Result<WithinRepCounterViewRecord> getWithinRepCounterViewRecords()
        Within replication view of that simulation counter results
        Returns:
        a jooq Result holding (simid, exp_name, element_name, stat_name, rep_num, last_value)
      • getAcrossRepViewRecords

        public final org.jooq.Result<AcrossRepViewRecord> getAcrossRepViewRecords()
        Across replication view of that simulation response results
        Returns:
        a jooq Result holding (simid, exp_name, element_name, stat_name, stat_count, average, std_dev)
      • getAcrossRepViewRecordsAsResultSet

        public final java.sql.ResultSet getAcrossRepViewRecordsAsResultSet()
        Returns:
        A JDBC ResultSet of the across replication view records.
      • getBatchStatViewRecords

        public final org.jooq.Result<BatchStatViewRecord> getBatchStatViewRecords()
        Batch statistic view of that simulation batch response results
        Returns:
        a jooq Result holding (simid, exp_name, element_name, stat_name, stat_count, average, std_dev)
      • getWithinRepViewRecords

        public final org.jooq.Result<WithinRepViewRecord> getWithinRepViewRecords()
        Returns observations for each replication for all ResponseVariable, TimeWeighted, and Counter responses. In the case of ResponseVariable and TimeWeighted response, the value field is the within replication average. In the case of a Counter, the value field is the last value of the counter variable (i.e. the total count for the replication).
        Returns:
        a jooq Result holding (simid, exp_name, stat_name, rep_num, value)
      • getPairWiseWithinRepViewRecords

        public org.jooq.Result<PwDiffWithinRepViewRecord> getPairWiseWithinRepViewRecords()
        Returns all of the pairwise differences (A - B) for each response variable, time weighted, and counters based on within replication data.

        (sim_name, A_SIM_NUM, STAT_NAME, A_EXP_NUM, REP_NUM, A_VALUE, B_SIM_NUM, B_EXP_NAME, B_VALUE, DIFF_NAME, A_MINUS_B)

        Returns:
        the jooq Result holding the records
      • getPairWiseAcrossRepRecords

        public org.jooq.Result<org.jooq.Record12<java.lang.String,​java.lang.String,​java.lang.String,​java.lang.String,​java.lang.String,​java.math.BigDecimal,​java.math.BigDecimal,​java.math.BigDecimal,​java.math.BigDecimal,​java.math.BigDecimal,​java.math.BigDecimal,​java.lang.Integer>> getPairWiseAcrossRepRecords()
        Across replication summary statistics for all pairwise differences (sim_name, stat_name, A_EXP_NAME, B_EXP_NAME, DIFF_NAME, AVG_A, STD_DEV_A, AVG_B, STD_DEV_B AVG_DIFF_A_MINUS_B, STD_DEV_DIFF_A_MINUS_B, STAT_COUNT)
        Returns:
        the jooq Result
      • getPairWiseAcrossRepRecordsAsResultSet

        public java.sql.ResultSet getPairWiseAcrossRepRecordsAsResultSet()
        Across replication summary statistics for all pairwise differences (sim_name, stat_name, A_EXP_NAME, B_EXP_NAME, DIFF_NAME, AVG_A, STD_DEV_A, AVG_B, STD_DEV_B AVG_DIFF_A_MINUS_B, STD_DEV_DIFF_A_MINUS_B, STAT_COUNT)
        Returns:
        the ResultSet
      • getWithinRepViewRecordsAsResultSet

        public final java.sql.ResultSet getWithinRepViewRecordsAsResultSet()
        Returns:
        the within replication view records as a JDBC ResultSet
      • getWithinRepViewRecordsBySimulationRunId

        public final java.util.Map<java.lang.Integer,​WithinRepViewRecord> getWithinRepViewRecordsBySimulationRunId()
        Returns:
        a map with key sim run id holding the within replication view records by simulation run id
      • getAcrossRepViewRecordsBySimulationRunId

        public final java.util.Map<java.lang.Integer,​AcrossRepViewRecord> getAcrossRepViewRecordsBySimulationRunId()
        Returns:
        a map with key sim run id holding the across replication view records
      • getAcrossRepStatistic

        public final Statistic getAcrossRepStatistic​(java.lang.Integer simId,
                                                     java.lang.String responseName)
        Parameters:
        simId - the id of the simulation
        responseName - the name of the model element that has observations within each replication. It can be a Counter, ResponseVariable, or TimeWeighted model element name
        Returns:
        the across replication statistics as a Statistic
      • getWithRepViewValuesAsMap

        public final java.util.Map<java.lang.Integer,​double[]> getWithRepViewValuesAsMap​(java.lang.String responseName)
        A map holding the values as an array for the within replication response values by simulation run
        Parameters:
        responseName - the name of the response variable, time weighted variable or counter
        Returns:
        a Map with key as simulation id and replication value in the array
      • getMultipleComparisonAnalyzerFor

        public final MultipleComparisonAnalyzer getMultipleComparisonAnalyzerFor​(java.util.Set<java.lang.String> expNames,
                                                                                 java.lang.String responseName)
        This prepares a map that can be used with MultipleComparisonAnalyzer and returns the MultipleComparisonAnalyzer. If the set of simulation runs does not contain the provided experiment name, then an IllegalArgumentException occurs. If there are multiple simulation runs with the same experiment name, then an IllegalArgumentException occurs. In other words, when running the experiments, the user must make the experiment names unique in order for this map to be built.
        Parameters:
        expNames - The set of experiment names for with the responses need extraction, must not be null
        responseName - the name of the response variable, time weighted variable or counter
        Returns:
        a configured MultipleComparisonAnalyzer
      • getWithinRepViewValuesAsMapForExperiments

        public final java.util.Map<java.lang.String,​double[]> getWithinRepViewValuesAsMapForExperiments​(java.util.Set<java.lang.String> expNames,
                                                                                                              java.lang.String responseName)
        This prepares a map that can be used with MultipleComparisonAnalyzer. If the set of simulation runs does not contain the provided experiment name, then an IllegalArgumentException occurs. If there are multiple simulation runs with the same experiment name, then an IllegalArgumentException occurs. In other words, when running the experiments, the user must make the experiment names unique in order for this map to be built.
        Parameters:
        expNames - The set of experiment names for with the responses need extraction, must not be null
        responseName - the name of the response variable, time weighted variable or counter
        Returns:
        a map with key exp_name containing an array of values, each value from each replication
      • getDatabase

        public final DatabaseIfc getDatabase()
        Returns:
        a reference to the underlying database via a DatabaseIfc
      • writeAllTablesAsText

        public void writeAllTablesAsText​(java.io.PrintWriter out)
        Writes all tables as text
        Parameters:
        out - the PrintWriter to write to
      • writeAllTablesAsCSV

        public void writeAllTablesAsCSV()
                                 throws java.io.IOException
        Writes all tables as separate comma separated value files into the jslOutput/excel directory. The files are written to text files using the same name as the tables in the database
        Throws:
        java.io.IOException - a checked exception
      • writeAllTablesAsCSV

        public void writeAllTablesAsCSV​(java.nio.file.Path pathToOutPutDirectory)
                                 throws java.io.IOException
        Writes all tables as separate comma separated value files into the supplied directory. The files are written to text files using the same name as the tables in the database
        Parameters:
        pathToOutPutDirectory - the path to the output directory to hold the csv files
        Throws:
        java.io.IOException - a checked exception
      • writeDbToExcelWorkbook

        public void writeDbToExcelWorkbook()
                                    throws java.io.IOException
        Writes all the tables to an Excel workbook, uses JSL.ExcelDir for the directory
        Throws:
        java.io.IOException - the checked exception
      • writeDbToExcelWorkbook

        public void writeDbToExcelWorkbook​(java.nio.file.Path wbDirectory)
                                    throws java.io.IOException
        Writes all the tables to an Excel workbook, uses name of database
        Parameters:
        wbDirectory - directory of the workbook, if null uses the working directory
        Throws:
        java.io.IOException - the checked exception
      • writeDbToExcelWorkbook

        public void writeDbToExcelWorkbook​(java.lang.String wbName)
                                    throws java.io.IOException
        Writes all the tables to an Excel workbook uses JSL.ExcelDir for the directory
        Parameters:
        wbName - name of the workbook, if null uses name of database
        Throws:
        java.io.IOException - the checked exception
      • writeDbToExcelWorkbook

        public void writeDbToExcelWorkbook​(java.lang.String wbName,
                                           java.nio.file.Path wbDirectory)
                                    throws java.io.IOException
        Writes all the tables to an Excel workbook
        Parameters:
        wbName - name of the workbook, if null uses name of database
        wbDirectory - directory of the workbook, if null uses the working directory
        Throws:
        java.io.IOException - the checked exception