• OAF_JDBC系列2


    d

           try{
              Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
              String connectionSQLServer = "jdbc:sqlserver://gavinmysql.com;databaseName=MDS;user=ViewMDSUserReadonly;password=MDSReadonly;";
              Statement stmtSource = null;
              Statement xstm = null;
              ResultSet rsSource = null;
              Connection msdbConn = DriverManager.getConnection(connectionSQLServer);
              try{
                  userGroup[] users = new userGroup[90000];
                  String msSql = null;
                 
                  if (xxAccountName !=null && !"".equals(xxAccountName))
                  {
                    msSql ="select ID,AdsPath,AccountName,AccountType,EmployeeNo,Name,DisplayName,Description, " +
                            "DepartmentID,DepartmentName,MemberOf,ObjectClass,Mail,TelephoneNumber,Mobile," +
                            "UserPrincipalName,SN,GivenName,Title,Department,Company,DirectReports,ManagerID," +
                            "Manager,OrderID,SyncTime,OrgID,OrgNumber,OrgNickNumber,OrgName,OrgDisplayName," +
                            "Disabled,Deleted from dbo.View_Mds_User where upper(AccountName)=" +"'"+ xxAccountName.toUpperCase() +
                            "' and Disabled="+"'"+"0"+"'";
                  }else
                  {
                        msSql ="select ID,AdsPath,AccountName,AccountType,EmployeeNo,Name,DisplayName,Description, " +
                                "DepartmentID,DepartmentName,MemberOf,ObjectClass,Mail,TelephoneNumber,Mobile," +
                                "UserPrincipalName,SN,GivenName,Title,Department,Company,DirectReports,ManagerID," +
                                "Manager,OrderID,SyncTime,OrgID,OrgNumber,OrgNickNumber,OrgName,OrgDisplayName," +
                                "Disabled,Deleted from dbo.View_Mds_User where Disabled="+"'"+"0"+"'";
                  }
                  
                  stmtSource = msdbConn.createStatement();
                  rsSource = stmtSource.executeQuery(msSql);
                  int r =0;
                  while (rsSource.next()){
                      users[r] = new userGroup();
                      users[r].strID = rsSource.getString("ID");
                      users[r].strAdsPath = rsSource.getString("AdsPath");
                      users[r].strAccountName = rsSource.getString("AccountName");
                      users[r].strAccountType = rsSource.getString("AccountType");
                      users[r].strEmployeeNo = rsSource.getString("EmployeeNo");
                      users[r].strName = rsSource.getString("Name");
                      users[r].strDisplayName = rsSource.getString("DisplayName");
                      users[r].strDescription = rsSource.getString("Description");
                      users[r].strDepartmentID = rsSource.getString("DepartmentID");
                      users[r].strDepartmentName = rsSource.getString("DepartmentName");
                      users[r].strMemberOf = rsSource.getString("MemberOf");
                      users[r].strObjectClass = rsSource.getString("ObjectClass");
                      users[r].strMail = rsSource.getString("Mail");
                      users[r].strTelephoneNumber = rsSource.getString("TelephoneNumber");
                      users[r].strMobile = rsSource.getString("Mobile");
                      users[r].strUserPrincipalName = rsSource.getString("UserPrincipalName");
                      users[r].strSN = rsSource.getString("SN");
                      users[r].strGivenName = rsSource.getString("GivenName");
                      users[r].strTitle = rsSource.getString("Title");
                      users[r].strDepartment = rsSource.getString("Department");
                      users[r].strCompany = rsSource.getString("Company");
                      users[r].strDirectReports = rsSource.getString("DirectReports");
                      users[r].strManagerID = rsSource.getString("ManagerID");
                      users[r].strManager = rsSource.getString("Manager");
                      users[r].strOrderID = rsSource.getString("OrderID");
                      users[r].strSyncTime = rsSource.getString("SyncTime");
                      users[r].strOrgID = rsSource.getString("OrgID");
                      users[r].strOrgNumber = rsSource.getString("OrgNumber");
                      users[r].strOrgNickNumber = rsSource.getString("OrgNickNumber");
                      users[r].strOrgName = rsSource.getString("OrgName");
                      users[r].strOrgDisplayName = rsSource.getString("OrgDisplayName");
                      users[r].strDisabled = rsSource.getString("Disabled");
                      users[r].strDeleted = rsSource.getString("Deleted");
                      //users[r].strChangeTime = rsSource.getString("ChangeTime");
                      r += 1;
                  }

  • 相关阅读:
    netty 服务端 启动阻塞主线程
    idea踩过的坑
    bat批量重命名
    图片上传
    TCP/IP入门指导
    CPU governor调节器汇总
    IT咨询顾问:一次吐血的项目救火
    python 数组
    Python字符串
    基于Python实现对各种数据文件的操作
  • 原文地址:https://www.cnblogs.com/eastsea/p/4641466.html
Copyright © 2020-2023  润新知