当前位置:首页 > 开发 > 系统架构 > 架构 > 正文

weblogic与portal用户同步

发表于: 2010-12-27   作者:Dead_knight   来源:转载   浏览:
摘要: String url = "t3://localhost:8001"; String username = "weblogic"; String password = "weblogic"; String serverNm = "portalServer&
        String url = "t3://localhost:8001";
        String username = "weblogic";
        String password = "weblogic";
        String serverNm = "portalServer";
        Connection con = getConnection();
        try
        {
            CommoMBeanServer cmbs = Config.getMBeanServer(serverNm,
                    url,
                    username,
                    password);
            DefaultAuthenticatorMBean dbean = (DefaultAuthenticatorMBean) cmbs.getMBean(new ObjectName(
                    "Security:Name=myrealmDefaultAuthenticator"));
         
            ResultSet rs = null;
	   PreparedStatement stmt = null;
	   String sqlStr =
	            " SELECT  username,  nvl(password,'123456') FROM tbl_um_user where username != 'weblogic'";
	       
	   stmt = con.prepareStatement(sqlStr);

	   rs = stmt.executeQuery();
	   while (rs.next())
	   {
	       try
                {
	           if(dbean.userExists(rs.getString(1)))
	           {
	               dbean.resetUserPassword(rs.getString(1),rs.getString(2));
	           }
	           else
	           {
	                     
	               dbean.createUser(rs.getString(1),rs.getString(2),"");
	           }
	        }
	        catch(Exception e)
	        {
	           e.printStackTrace();
	        }	
	     }
        }
        catch (ClassNotFoundException e)
        {
            e.printStackTrace();
        }
        catch (InvalidParameterException e)
        {
            e.printStackTrace();
        }
        catch (JMException e)
        {
            e.printStackTrace();
        }
        catch (SQLException e)
        {
            e.printStackTrace();
        }

weblogic与portal用户同步

  • 0

    开心

    开心

  • 0

    板砖

    板砖

  • 0

    感动

    感动

  • 0

    有用

    有用

  • 0

    疑问

    疑问

  • 0

    难过

    难过

  • 0

    无聊

    无聊

  • 0

    震惊

    震惊

版权所有 IT知识库 CopyRight © 2009-2015 IT知识库 IT610.com , All Rights Reserved. 京ICP备09083238号