<%@ page contentType="text/html; charset=utf-8" language="java" import="java.sql.*" errorPage="" %>
<%!
//database.sql.inc.jsp
public Connection getConnection(String module) throws SQLException 
{
    String db_host="";
    String db_user="regis.dev";
    String db_password="Xmb99k";
    
    if (module.equals("MIS")) {
        db_host="jdbc:oracle:thin:@192.168.11.11:1521:BSRUMIS";
    } else if (module.equals("ERP")) {
        db_host="jdbc:oracle:thin:@192.168.11.12:1521:BSRUERP";
    } else {
        return null;
    }
    
    Connection con =null;
    try {
        Class.forName ("oracle.jdbc.driver.OracleDriver");
        con = DriverManager.getConnection (db_host, db_user, db_password);
    } catch (ClassNotFoundException e) {}
    return con;
}//getConnection()

public ResultSet getResultSet(Connection con,String sql) throws SQLException 
{
    PreparedStatement ps=con.prepareStatement(sql);
    ResultSet rs=ps.executeQuery();
    
    return rs;
}//getResultSet()

public int getColumnCount(ResultSet rs) throws SQLException 
{
    ResultSetMetaData rsmd = rs.getMetaData();  
	int numberOfColumns = rsmd.getColumnCount();
    
    return numberOfColumns;
} //getResultSetMetaData()

%>