/**
  * @param dataSourceStub JDataSourceStub
  * @return JConnection
  * @throws Exception
  */
 protected static JConnection createConnection(JDataSourceStub dataSourceStub) throws Exception {
   JConnection jconn = null;
   if (dataSourceStub.DBClass == null) {
     dataSourceStub.DBClass = Class.forName(dataSourceStub.classname);
   }
   if (dataSourceStub.NAClass == null) {
     dataSourceStub.NAClass = Class.forName(dataSourceStub.dbclass);
   }
   if (dataSourceStub.NAClass != null) {
     jconn = (JConnection) dataSourceStub.NAClass.newInstance();
   }
   if (jconn != null) jconn.setDataBaseType(dataSourceStub.DataBaseType);
   return jconn;
 }
 boolean lookDataSource(JConnection jconn, JParamObject PO) throws Exception {
   boolean hasDataSource = false;
   if (jconn != null) {
     String dataSource = PO.GetValueByEnvName("DataSource");
     if (dataSource != null && !"".equals(dataSource)) {
       DataSource ds = null;
       //        try {
       //          ds = (DataSource) jconn.getDBContext().lookup("jdbc/" +
       //              dataSource);
       //        }
       //        catch (Exception e) {
       //          Context context = new InitialContext();
       //          Context envContext = (Context) context.lookup(
       //              "java:/comp/env");
       //          ds = (DataSource) envContext.lookup("jdbc/" + dataSource);
       //
       //        }
       if (ds != null) {
         jconn.getInstance(ds.getConnection());
         hasDataSource = true;
       }
     }
   }
   return hasDataSource;
 }
 /**
  * @param conn JConnection
  * @param PO JParamObject
  * @param DSS JDataSourceStub
  * @param custObj Object
  * @return JConnection
  * @throws Exception
  */
 protected static JConnection initConnection(
     JConnection conn,
     JParamObject PO,
     JDataSourceStub dataSourceStub,
     AccountStub accountStub,
     DataStorageStub dataStorageStub)
     throws Exception {
   if (conn.InitConnection(PO, dataSourceStub, accountStub, dataStorageStub) == null) return null;
   //    if (PO.isAutoConnection()) {
   //      PO.addConn(conn);
   //    }
   // 写入日志
   writeLoginfo(conn, PO);
   // add by fsz
   List sqlList = (List) PO.getValue("$$SQL_VIEWLIST", null);
   if (sqlList != null) {
     //      conn.setSqlLogList(sqlList);
   }
   return conn;
 }