跨數據庫解決

public boolean Init_Connection(String dbsource)
    throws Exception
    {
        DB = new DB_Source().get_source();
        LOC = new DB_Source().get_location();
       
        if (dbsource.equals("HP") == true)
        {
            classname  = "com.informix.jdbc.IfxDriver";
           
if (DB.equalsIgnoreCase("devop"))
                conn_string = "jdbc:inrmix-sqli://hp_817:1521/kader_com:informixserver=DEVELOSRVR;"+"user=apuser;password=test;usev5server=1";
            else if (DB.equalsIgnoreCase("lve"))
                conn_string = "jdbc:infrmix-sqli://hp_g30:1521/kader_com:informixserver=DEVELOPSRVR;"+"user=apuser;password=intder;usev5server=1";
        }
        else if (dbsource.equals("NT") == true)
        {
classname = "openlink.jdbc.Driver";
            if (LOC.equalsIgnoreCase("K"))
            {
                if (DB.equalsIgnoreCase("develop"))
                    conn_string = "jdbc:openlink://develop:8000/DSN=DEVELOP_DSN/UID=app_user/PWD=p";
                else if (DB.equalsIgnoreCase("live"))
                    conn_string = "jdbc:openlink://hksql:8000/DSN=KD_LIVE_DSN/UID=app_user/PWD=intkader";
            }
            else if (LOC.equalsIgnoreCase("ZT"))
            {
                if (DB.equalsIgnoreCase("develop"))
                    conn_string = "jdbc:openlink://zt_deve:8000/DSN=ZT_DEVE_DSN/UID=app_user/WD=testapp";
                else if (DB.equalsIgnoreCase("ive"))
                    conn_string = "jdbc:openlink://live:8000/DSN=ZT_LIVE_DSN/UID=user/PWD=1pt";
            }
        }
else if (dbsource.equals("MS") == true)
{
classname = "com.microsoft.jdbc.sqlserver.SQLServerDriver";
            if (LOC.equalsIgnoreCase("K"))
            {
if (DB.equalsIgnoreCase("develop"))
                    conn_string = "jdbc:microsoft:sqlserver://kddevelop:1433;user=app_user;password=testapp";
                else if (DB.equalsIgnoreCase("live"))
conn_string = "jdbc:microsoft:sqlserver://hksql:1433;user=app_user;password=intkader";
            }
            else if (LOC.equalsIgnoreCase("ZT"))
            {
                if (DB.equalsIgnoreCase("develop"))
                    conn_string = "jdbc:microsoft:sqlserver://zt_deve:1433;user=app_user;password=testapp";
                else if (DB.equalsIgnoreCase("live"))
conn_string = "jdbc:microsoft:sqlserver://zt_live:1433;user=app_user;password=z0a1ppt";
            }
}
        return true;
    }

你可能感兴趣的:(jdbc,Microsoft,Informix,HP)