Exemplo n.º 1
0
 /**
  * @param accountStub AccountStub
  * @return JDataSourceStub
  * @throws Exception
  */
 protected static JDataSourceStub getDataSourceStub(DataStorageStub dataStorageStub)
     throws Exception {
   String dbType = dataStorageStub.getDBType();
   JDataSourceStub DSS;
   for (int i = 0; i < DBList.size(); i++) {
     DSS = (JDataSourceStub) DBList.get(i);
     if (DSS.DataBaseType.toLowerCase().equals(dbType.toLowerCase())) return DSS;
   }
   return null;
 }
Exemplo n.º 2
0
 /**
  * @param ParamObject Object
  * @param DataObject Object
  * @param CustomObject Object
  * @param AdditiveObject Object
  * @return Object
  * @throws Exception
  */
 public Object CheckDBDataSource(
     Object ParamObject, Object DataObject, Object CustomObject, Object AdditiveObject)
     throws Exception {
   JParamObject PO;
   String DBType;
   JDataSourceStub DSS;
   JConnection jconn = null;
   boolean hasDataSource = false;
   PO = (JParamObject) ParamObject;
   DBType = PO.GetValueByEnvName("DataBaseType");
   for (int i = 0; i < DBList.size(); i++) {
     DSS = (JDataSourceStub) DBList.get(i);
     if (DSS.DataBaseType.toLowerCase().equals(DBType.toLowerCase()) == true) {
       if (DSS.DBClass == null) {
         DSS.DBClass = Class.forName(DSS.classname);
       }
       if (DSS.NAClass == null) {
         DSS.NAClass = Class.forName(DSS.dbclass);
       }
       if (DSS.NAClass != null) {
         jconn = (JConnection) DSS.NAClass.newInstance();
         try {
           hasDataSource = lookDataSource(jconn, PO);
         } catch (Exception e) {
           e.printStackTrace();
         }
         if (hasDataSource) break;
       }
     }
   }
   if (!hasDataSource) {
     throw new Exception("ϵͳû���ṩ" + DBType + "������ݿ�������!");
   }
   if (hasDataSource) return jconn;
   return null;
 }