HmiDb.java

package com.workbenchclassic.hmi;

import com.workbenchclassic.DBService;
import java.sql.Connection;
import java.sql.SQLException;

/** Uses the existing GlassFish dsCustNJTA connection and the existing DBService. */
final class HmiDb {
    private static final DBService SERVICE = new DBService("dsCustNJTA");
    private static volatile String schemaPrefix = "CUST.";
    static void useDatabase(boolean oracle) { schemaPrefix = oracle ? "CUST." : "cust."; }
    static String schemaPrefix() { return schemaPrefix; }
    static boolean isOracle() { return "CUST.".equals(schemaPrefix); }
    private HmiDb() { }
    static Connection open() throws SQLException { return SERVICE.getConnection(); }
}