public String[] getPrimaryKeys(String table, String schema) {
        try {
            DatabaseMetaData metaData = this.getConnection().getMetaData();

            ResultSet results = metaData.getPrimaryKeys(null, schema, table);

            if (null == results) {
                return null;
            }

            try {
                ArrayList<String> pks = new ArrayList<>();
                while (results.next()) {
                    String pkName = results.getString("COLUMN_NAME");
                    if (this.options.getQuotedIdentifiers())
                        pks.add("\"" + pkName + "\"");
                    else
                        pks.add(pkName);
                }

                if (pks.isEmpty())
                    return null;
                else
                    return pks.toArray(new String[0]);

            } finally {
                results.close();
                getConnection().commit();
            }
        } catch (SQLException sqlException) {
            LOG.error("Error reading primary key metadata: " + sqlException.toString(), sqlException);
            return null;
        }
    }
Create a connection to the database; usually used only from within
getConnection(), which enforces a singleton guarantee around the
Connection object.
src/main/java/org/replicadb/manager/SqlManager.java