DbUtils Class

Provides static methods used to initialize a database, copy data from one database to another, find/remove duplicates records, etc.

Constructors

public DbUtils( )

Methods

copyTable( String tableName, String where, Database sourceDB, Database destDB, int pageSize, int numThreads ) returns void
Used to transfer records between 2 databases for a given table.
deleteDuplicates( String tableName, Database database, Long startRow, Long endRow, int pageSize, int numThreads ) returns void
Used to find and delete duplicates in a given table.
executeBatch( java.util.ArrayList statements, Connection conn ) returns void
findMismatch( String tableName, Database sourceDB, Database destDB, int pageSize, long offset, java.util.concurrent.atomic.AtomicLong rowID ) returns void
Used to find mismatched between the 2 databases for a given table.
getColumns( String tableName, Database sourceDB ) returns java.util.LinkedHashMap
getJson( Recordset rs ) returns JSONObject
Returns a JSON representation of a record in a Recordset
initSchema( Database database, String schema ) returns void
initSchema( Database database, String schema, String tableSpace ) returns boolean
Used to execute SQL statements and populate a database with table, views, triggers, etc. If the target database does not exist, an attempt is made to create a new database. Currently only supports PostgreSQL and H2.
databaseConnection info for the database
schemaString containing SQL statements. Assumes individual statements are delimited with a semicolon.
tableSpaceDefault tablespace used to store tables, views, etc. If null, will use the default database tablespace. This option only applies to PostgreSQL