??xml version="1.0" encoding="utf-8" standalone="yes"?>久久免费看视频,一级欧美视频,影音先锋国产精品http://www.aygfsteel.com/amenglai/看不完的牙,写不完的E序Q跑不完的步?/description>zh-cnTue, 17 Jun 2025 22:41:22 GMTTue, 17 Jun 2025 22:41:22 GMT60MySQL 定义异常http://www.aygfsteel.com/amenglai/archive/2013/10/24/405583.htmlamenglaiamenglaiThu, 24 Oct 2013 02:24:00 GMThttp://www.aygfsteel.com/amenglai/archive/2013/10/24/405583.htmlhttp://www.aygfsteel.com/amenglai/comments/405583.htmlhttp://www.aygfsteel.com/amenglai/archive/2013/10/24/405583.html#Feedback0http://www.aygfsteel.com/amenglai/comments/commentRss/405583.htmlhttp://www.aygfsteel.com/amenglai/services/trackbacks/405583.html


MySQL5.6Q?/span>SIGNAL可以Ҏ(gu)变量的|抛出Exception?/span>

试数据

create table t1(f1 int);

insert into t1(f1) values(2);

insert into t1(f1) values(12);

insert into t1(f1) values(4);

insert into t1(f1) values(6);

insert into t1(f1) values(7);

 

存储q程定义

-- --------------------------------------------------------------------------------

-- Routine DDL

-- Note: comments before and after the routine body will not be stored by the server

-- --------------------------------------------------------------------------------

DELIMITER $$

 

CREATE PROCEDURE `my_test`

 (

    in_c_t int

 )

BEGIN

 DECLARE my_n_t int;

 DECLARE specialty CONDITION FOR SQLSTATE '45000';

 

SELECT count(1) into my_n_t

    FROM t1

    WHERE f1 = in_c_t;

 

IF my_n_t = 0 THEN

    SIGNAL SQLSTATE '45000'

      SET MESSAGE_TEXT = 'Can not deleteQ?/span>';

end IF;

 

 delete from t1 WHERE f1 = in_c_t;

 COMMIT ;

 

END

 

执行

call my_test(2);

输出Q?br />






amenglai 2013-10-24 10:24 发表评论
]]>
Oracle q个SQL该怎么写?http://www.aygfsteel.com/amenglai/archive/2013/10/09/404785.htmlamenglaiamenglaiWed, 09 Oct 2013 03:12:00 GMThttp://www.aygfsteel.com/amenglai/archive/2013/10/09/404785.htmlhttp://www.aygfsteel.com/amenglai/comments/404785.htmlhttp://www.aygfsteel.com/amenglai/archive/2013/10/09/404785.html#Feedback0http://www.aygfsteel.com/amenglai/comments/commentRss/404785.htmlhttp://www.aygfsteel.com/amenglai/services/trackbacks/404785.html


?/span>1 T1Q字D?/span> ID VALUE

CREATE TABLE T1(ID VARCHAR2(20), VALUE NUMBER(5));

?/span>2 T2Q字D?/span> ID VALUE

CREATE TABLE T2(ID VARCHAR2(20), VALUE NUMBER(5));

?/span>1数据如下

ID

VALUE

A

2

C

12

INSERT INTO T1(ID,VALUE) VALUES('A',2);

INSERT INTO T1(ID,VALUE) VALUES('C',12);

?/span>2数据如下Q?/span>

ID

VALUE

A

23

B

7

INSERT INTO T2(ID,VALUE) VALUES('A',23);

INSERT INTO T2(ID,VALUE) VALUES('B',7);

 

希望得到的结果是Q?/span>

ID

VALUE

A

25

B

7

C

12

 

其实是要得到合?/span>

 

SQL语句如下Q?/span>

SELECT ID,SUM(VALUE)

FROM

(

SELECT * FROM T1

UNION

SELECT * FROM T2

) GROUP BY ID

 



amenglai 2013-10-09 11:12 发表评论
]]>
Oracle计算指定日期到月末的双休日的天数http://www.aygfsteel.com/amenglai/archive/2013/08/28/403424.htmlamenglaiamenglaiWed, 28 Aug 2013 15:15:00 GMThttp://www.aygfsteel.com/amenglai/archive/2013/08/28/403424.htmlhttp://www.aygfsteel.com/amenglai/comments/403424.htmlhttp://www.aygfsteel.com/amenglai/archive/2013/08/28/403424.html#Feedback0http://www.aygfsteel.com/amenglai/comments/commentRss/403424.htmlhttp://www.aygfsteel.com/amenglai/services/trackbacks/403424.html
业务逻辑Q?/div>
count=0;
计算得到指定日期的下一个周日my_nextsunday
计算得到月末my_lastdate
IF 下一个周?lt;=月末 THEN
  周数=Q月?下一个周日的天数Q?7
  余数=Q月?下一个周日的天数Q?7
  IF 余数Q?0 THEN count=1;
  count+=周数*2
  IF DAYOFWEEKQ指定日期)(j)=1 THEN count+=2Q?/div>
  ELSE count+=1Q?/div>
ELSE
  计算 DAYOFWEEKQ指定日期)(j)-> DWS
  计算 DAYOFWEEKQ月末)(j)-> DWE
  IF DWS<=DME THEN --没有跨周
    IF DWS=1 THEN count+=1Q?/div>
    IF DWE=7 THEN count+=1Q?/div>
  ELSE count=2Q?/div>
END IF;

CREATE OR REPLACE FUNCTION WEEKENDDAY( IN_APP_DATE IN DATE)
RETURN integer IS
    my_lastdate DATE;
    my_nextsunday DATE;
    my_weeks integer;
    my_n_diff integer;
    my_remain integer;
    my_dws integer;
    my_dwe integer;
    out_count integer :=0;
BEGIN
   my_lastdate:=LAST_DAY(IN_APP_DATE);
   select NEXT_DAY(IN_APP_DATE,1) INTO my_nextsunday from dual;
   my_n_diff:=TRUNC( (  my_lastdate - my_nextsunday ), 0 )+1;
   if(my_nextsunday<=my_lastdate) THEN
     my_weeks:=FLOOR(my_n_diff/7);
     my_remain:=mod(my_n_diff,7);
     if my_remain>0 THEN 
       out_count:=1; 
     END IF;    
     out_count:=out_count+my_weeks*2;
     IF to_number(to_char(IN_APP_DATE,'D'))=1 THEN 
       out_count:=out_count+2;
     ELSE 
       out_count:=out_count+1;
     END IF;   
   ELSE
     my_dws:=to_number(to_char(IN_APP_DATE,'D'));
     my_dwe:=to_number(to_char(my_lastdate,'D'));
     IF my_dws<=my_dwe THEN
       IF my_dws=1 THEN 
         out_count:=out_count+1;
       END IF;    
       IF my_dwe=7 THEN 
         out_count:=out_count+1;
       END IF;    
     ELSE
       out_count:=2;
     END IF;  
   end if;
   return out_count;
END WEEKENDDAY;


amenglai 2013-08-28 23:15 发表评论
]]>Xfire 部v错误http://www.aygfsteel.com/amenglai/archive/2013/03/18/396591.htmlamenglaiamenglaiMon, 18 Mar 2013 07:06:00 GMThttp://www.aygfsteel.com/amenglai/archive/2013/03/18/396591.htmlhttp://www.aygfsteel.com/amenglai/comments/396591.htmlhttp://www.aygfsteel.com/amenglai/archive/2013/03/18/396591.html#Feedback0http://www.aygfsteel.com/amenglai/comments/commentRss/396591.htmlhttp://www.aygfsteel.com/amenglai/services/trackbacks/396591.html

?/span>xfire写了(jin)?/span> web serviceQ在开发环境没有Q何问题,可以正常讉KQ但是部|到q行环境Q我去,一堆的问题Q无法用?/span>

一句一句的跟踪Q执行到q句Q系l就归西?/span>

Service srvcModel = new ObjectServiceFactory().create(EmsReportInterface.class);

查看后台的错误信息,发现都是׃~少必要?/span>jar包造成的,但是q些jar包在开发环境里q不需要:(x)

Caused by: javax.xml.stream.FactoryConfigurationError: Provider com.bea.xml.stream.MXParserFactory not found

~少wstx-asl-3.2.0.jar?/span>stax-api-1.0.1.jar,

Caused by: ognl.OgnlException: downloadFile [java.lang.NoClassDefFoundError: javax/xml/stream/XMLStreamReader]

~少jsr173_api-1.0.jar

Caused by: java.lang.NoClassDefFoundError: javax/activation/DataSource

~少activation.jar

以上q些jar包需要添加到WEB-INF\lib目录下?/span>

另外WEB-INF\classes目录下的wsdl文g׃环境的差异,最好重新生成?/span>

对应url: http://127.0.0.1:8080/AppName/services/

例如Q?/span>http://127.0.0.1:8080/ems/services/

 



amenglai 2013-03-18 15:06 发表评论
]]>J2EE Development without EJBMW记http://www.aygfsteel.com/amenglai/archive/2013/02/22/395584.htmlamenglaiamenglaiFri, 22 Feb 2013 08:31:00 GMThttp://www.aygfsteel.com/amenglai/archive/2013/02/22/395584.htmlhttp://www.aygfsteel.com/amenglai/comments/395584.htmlhttp://www.aygfsteel.com/amenglai/archive/2013/02/22/395584.html#Feedback0http://www.aygfsteel.com/amenglai/comments/commentRss/395584.htmlhttp://www.aygfsteel.com/amenglai/services/trackbacks/395584.html阅读全文

amenglai 2013-02-22 16:31 发表评论
]]>
J2EE Development without EJBd?/title><link>http://www.aygfsteel.com/amenglai/archive/2013/02/22/395583.html</link><dc:creator>amenglai</dc:creator><author>amenglai</author><pubDate>Fri, 22 Feb 2013 08:30:00 GMT</pubDate><guid>http://www.aygfsteel.com/amenglai/archive/2013/02/22/395583.html</guid><wfw:comment>http://www.aygfsteel.com/amenglai/comments/395583.html</wfw:comment><comments>http://www.aygfsteel.com/amenglai/archive/2013/02/22/395583.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/amenglai/comments/commentRss/395583.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/amenglai/services/trackbacks/395583.html</trackback:ping><description><![CDATA[<div><span style="color: #464646; font-family: simsun; "><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 5px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; list-style-type: none; list-style-position: initial; list-style-image: initial; border-style: initial; border-color: initial; word-wrap: normal; word-break: normal; line-height: 21px; "><span style="word-wrap: normal; word-break: normal; line-height: 21px; font-family: 宋体; ">伴随</span><span xml:lang="EN-US" style="word-wrap: normal; word-break: normal; line-height: 21px; ">Spring</span><span style="word-wrap: normal; word-break: normal; line-height: 21px; font-family: 宋体; ">的流行,出现?jin)大量的关?/span><span xml:lang="EN-US" style="word-wrap: normal; word-break: normal; line-height: 21px; ">Spring</span><span style="word-wrap: normal; word-break: normal; line-height: 21px; font-family: 宋体; ">的书c,q些书被冠以_N,入门Q实战,巴拉巴拉。让人眼q݋乱。这些书大多讲的?/span><span xml:lang="EN-US" style="word-wrap: normal; word-break: normal; line-height: 21px; ">how to do</span><span style="word-wrap: normal; word-break: normal; line-height: 21px; font-family: 宋体; ">Q?/span><span xml:lang="EN-US" style="word-wrap: normal; word-break: normal; line-height: 21px; ">Spring</span><span style="word-wrap: normal; word-break: normal; line-height: 21px; font-family: 宋体; ">作?/span><span xml:lang="EN-US" style="word-wrap: normal; word-break: normal; line-height: 21px; ">rod</span><span style="word-wrap: normal; word-break: normal; line-height: 21px; font-family: 宋体; ">写的</span><span xml:lang="EN-US" style="word-wrap: normal; word-break: normal; line-height: 21px; ">Spring</span><span style="word-wrap: normal; word-break: normal; line-height: 21px; font-family: 宋体; ">三部Ԍ(x)</span></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 5px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; list-style-type: none; list-style-position: initial; list-style-image: initial; border-style: initial; border-color: initial; word-wrap: normal; word-break: normal; line-height: 21px; "><span xml:lang="EN-US" style="word-wrap: normal; word-break: normal; line-height: 21px; ">J2EE Design and Development</span></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 5px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; list-style-type: none; list-style-position: initial; list-style-image: initial; border-style: initial; border-color: initial; word-wrap: normal; word-break: normal; line-height: 21px; "><span xml:lang="EN-US" style="word-wrap: normal; word-break: normal; line-height: 21px; ">J2EE Development without EJB</span></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 5px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; list-style-type: none; list-style-position: initial; list-style-image: initial; border-style: initial; border-color: initial; word-wrap: normal; word-break: normal; line-height: 21px; "><span xml:lang="EN-US" style="word-wrap: normal; word-break: normal; line-height: 21px; ">Professional Java Development with the Spring Framework</span></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 5px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; list-style-type: none; list-style-position: initial; list-style-image: initial; border-style: initial; border-color: initial; word-wrap: normal; word-break: normal; line-height: 21px; "><span style="word-wrap: normal; word-break: normal; line-height: 21px; font-family: 宋体; ">让我们明白的?/span><span xml:lang="EN-US" style="word-wrap: normal; word-break: normal; line-height: 21px; ">why to do</span></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 5px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; list-style-type: none; list-style-position: initial; list-style-image: initial; border-style: initial; border-color: initial; word-wrap: normal; word-break: normal; line-height: 21px; "><strong><span style="word-wrap: normal; word-break: normal; line-height: 21px; font-family: 宋体; ">M的目?/span></strong></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 5px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; list-style-type: none; list-style-position: initial; list-style-image: initial; border-style: initial; border-color: initial; word-wrap: normal; word-break: normal; line-height: 21px; "><span xml:lang="EN-US" style="word-wrap: normal; word-break: normal; line-height: 21px; ">J2EE Development without EJB</span><span style="word-wrap: normal; word-break: normal; line-height: 21px; font-family: 宋体; ">讲述的就?/span><span xml:lang="EN-US" style="word-wrap: normal; word-break: normal; line-height: 21px; ">why to do</span><span style="word-wrap: normal; word-break: normal; line-height: 21px; font-family: 宋体; ">。所以你如果想知?/span><span xml:lang="EN-US" style="word-wrap: normal; word-break: normal; line-height: 21px; ">Spring</span><span style="word-wrap: normal; word-break: normal; line-height: 21px; font-family: 宋体; ">中某个配|是怎么怎么写,参数是什么含义,q本书的帮不上忙。如果是W一ơ接?/span><span xml:lang="EN-US" style="word-wrap: normal; word-break: normal; line-height: 21px; ">Spring</span><span style="word-wrap: normal; word-break: normal; line-height: 21px; font-family: 宋体; ">Q读完这本书Q估计连?/span><span xml:lang="EN-US" style="word-wrap: normal; word-break: normal; line-height: 21px; ">Spring</span><span style="word-wrap: normal; word-break: normal; line-height: 21px; font-family: 宋体; ">的配|文仉写不好?/span><span xml:lang="EN-US" style="word-wrap: normal; word-break: normal; line-height: 21px; ">5</span><span style="word-wrap: normal; word-break: normal; line-height: 21px; font-family: 宋体; ">q前我就是抱着</span><span xml:lang="EN-US" style="word-wrap: normal; word-break: normal; line-height: 21px; ">how to do</span><span style="word-wrap: normal; word-break: normal; line-height: 21px; font-family: 宋体; ">的想法读q本书的Q以为想d?jin),可以在已有的系l引?/span><span xml:lang="EN-US" style="word-wrap: normal; word-break: normal; line-height: 21px; ">Spring</span><span style="word-wrap: normal; word-break: normal; line-height: 21px; font-family: 宋体; ">。结果可惌知Q当时我都觉得这书写的还?sh)如在线文档?/span></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 5px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; list-style-type: none; list-style-position: initial; list-style-image: initial; border-style: initial; border-color: initial; word-wrap: normal; word-break: normal; line-height: 21px; "><strong><span style="word-wrap: normal; word-break: normal; line-height: 21px; font-family: 宋体; ">d些章?/span></strong></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 5px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; list-style-type: none; list-style-position: initial; list-style-image: initial; border-style: initial; border-color: initial; word-wrap: normal; word-break: normal; line-height: 21px; "><span xml:lang="EN-US" style="word-wrap: normal; word-break: normal; line-height: 21px; ">Spring</span><span style="word-wrap: normal; word-break: normal; line-height: 21px; font-family: 宋体; ">是个很庞大的pȝQ涵盖企业应用的所有内宏V从后台数据库到前台展示的所有内容,但其实个人用到的很有限。例如现在的pȝQ用</span><span xml:lang="EN-US" style="word-wrap: normal; word-break: normal; line-height: 21px; ">EJB</span><span style="word-wrap: normal; word-break: normal; line-height: 21px; font-family: 宋体; ">的越来越了(jin)Q所以徏议蟩q关?/span><span xml:lang="EN-US" style="word-wrap: normal; word-break: normal; line-height: 21px; ">EJB</span><span style="word-wrap: normal; word-break: normal; line-height: 21px; font-family: 宋体; ">的章节。我选读?/span><span xml:lang="EN-US" style="word-wrap: normal; word-break: normal; line-height: 21px; ">6,7,9,10,14</span><span style="word-wrap: normal; word-break: normal; line-height: 21px; font-family: 宋体; ">章,其实</span><span xml:lang="EN-US" style="word-wrap: normal; word-break: normal; line-height: 21px; ">15</span><span style="word-wrap: normal; word-break: normal; line-height: 21px; font-family: 宋体; ">章性能与可伸羃性也应该诅R?/span></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 5px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; list-style-type: none; list-style-position: initial; list-style-image: initial; border-style: initial; border-color: initial; word-wrap: normal; word-break: normal; line-height: 21px; "><strong><span style="word-wrap: normal; word-break: normal; line-height: 21px; font-family: 宋体; ">如何?/span></strong></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 5px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; list-style-type: none; list-style-position: initial; list-style-image: initial; border-style: initial; border-color: initial; word-wrap: normal; word-break: normal; line-height: 21px; "><span style="word-wrap: normal; word-break: normal; line-height: 21px; font-family: 宋体; ">q本书首先值得反复读,而不是仅仅读一遍。因为它不是手册。每M章,我都感觉在看一部大片,</span><span xml:lang="EN-US" style="word-wrap: normal; word-break: normal; line-height: 21px; ">rod</span><span style="word-wrap: normal; word-break: normal; line-height: 21px; font-family: 宋体; ">引导我们渐渐q入</span><span xml:lang="EN-US" style="word-wrap: normal; word-break: normal; line-height: 21px; ">Spring</span><span style="word-wrap: normal; word-break: normal; line-height: 21px; font-family: 宋体; ">的神奇世界。ؓ(f)什么要反复读?大概是我W的原因Q经常读到最后才恍然大?zhn)Q然后就觉得前面g落下?jin)什么。就像一部?zhn)疑片说Q最后谜底揭开?jin),你恍然大?zhn),然后重新再看一遍,体会(x)中间的蛛丝马qV?/span></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 5px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; list-style-type: none; list-style-position: initial; list-style-image: initial; border-style: initial; border-color: initial; word-wrap: normal; word-break: normal; line-height: 21px; "><span style="word-wrap: normal; word-break: normal; line-height: 21px; font-family: 宋体; ">千万不要提前ȝ每章的小l部分,q是?/span><span xml:lang="EN-US" style="word-wrap: normal; word-break: normal; line-height: 21px; ">rod</span><span style="word-wrap: normal; word-break: normal; line-height: 21px; font-family: 宋体; ">带我们进入那个神奇的世界。不是每本书都有q样的体验的Q珍惜?/span></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 5px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; list-style-type: none; list-style-position: initial; list-style-image: initial; border-style: initial; border-color: initial; word-wrap: normal; word-break: normal; line-height: 21px; "><span style="word-wrap: normal; word-break: normal; line-height: 21px; font-family: 宋体; ">另外Q如果木有语a障碍Q还是看原版吧。其?/span><span xml:lang="EN-US" style="word-wrap: normal; word-break: normal; line-height: 21px; ">Javaeye</span><span style="word-wrap: normal; word-break: normal; line-height: 21px; font-family: 宋体; ">的翻译已l很?gu)了(jin),但是毕竟不如直接d文来的直接,当然最好手边能配上本中文版Q晦涩难懂时M。不q,不过q本书的中文版已l是l版书了(jin)Q找CҎ(gu)?jin)。哈哈,我有?/span></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 5px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; list-style-type: none; list-style-position: initial; list-style-image: initial; border-style: initial; border-color: initial; word-wrap: normal; word-break: normal; line-height: 21px; "><strong><span style="word-wrap: normal; word-break: normal; line-height: 21px; font-family: 宋体; ">然后?/span></strong></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 5px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; list-style-type: none; list-style-position: initial; list-style-image: initial; border-style: initial; border-color: initial; word-wrap: normal; word-break: normal; line-height: 21px; "><span style="word-wrap: normal; word-break: normal; line-height: 21px; font-family: 宋体; ">dq本书,我ؓ(f)自己拉了(jin)个新的书单:(x)</span></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 5px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; list-style-type: none; list-style-position: initial; list-style-image: initial; border-style: initial; border-color: initial; word-wrap: normal; word-break: normal; line-height: 21px; "><span xml:lang="EN-US" style="word-wrap: normal; word-break: normal; line-height: 21px; ">Junit in Action</span></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 5px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; list-style-type: none; list-style-position: initial; list-style-image: initial; border-style: initial; border-color: initial; word-wrap: normal; word-break: normal; line-height: 21px; "><span xml:lang="EN-US" style="word-wrap: normal; word-break: normal; line-height: 21px; ">J2EE Design and Development</span></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 5px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; list-style-type: none; list-style-position: initial; list-style-image: initial; border-style: initial; border-color: initial; word-wrap: normal; word-break: normal; line-height: 21px; "><span xml:lang="EN-US" style="word-wrap: normal; word-break: normal; line-height: 21px; ">Professional Java Development with the Spring Framework</span></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 5px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; list-style-type: none; list-style-position: initial; list-style-image: initial; border-style: initial; border-color: initial; word-wrap: normal; word-break: normal; line-height: 21px; "><span xml:lang="EN-US" style="word-wrap: normal; word-break: normal; line-height: 21px; ">Core J2EE patterns</span></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 5px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; list-style-type: none; list-style-position: initial; list-style-image: initial; border-style: initial; border-color: initial; word-wrap: normal; word-break: normal; line-height: 21px; "><span xml:lang="EN-US" style="word-wrap: normal; word-break: normal; line-height: 21px; ">PEAA</span></p></span></div><img src ="http://www.aygfsteel.com/amenglai/aggbug/395583.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/amenglai/" target="_blank">amenglai</a> 2013-02-22 16:30 <a href="http://www.aygfsteel.com/amenglai/archive/2013/02/22/395583.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>内存泄漏 - 开?数据库应?/title><link>http://www.aygfsteel.com/amenglai/archive/2013/01/18/394386.html</link><dc:creator>amenglai</dc:creator><author>amenglai</author><pubDate>Fri, 18 Jan 2013 03:14:00 GMT</pubDate><guid>http://www.aygfsteel.com/amenglai/archive/2013/01/18/394386.html</guid><wfw:comment>http://www.aygfsteel.com/amenglai/comments/394386.html</wfw:comment><comments>http://www.aygfsteel.com/amenglai/archive/2013/01/18/394386.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/amenglai/comments/commentRss/394386.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/amenglai/services/trackbacks/394386.html</trackback:ping><description><![CDATA[最q都在读那个该死的猪弟写的代码Q原因还?sh)是因?f)压力试后,发现TMD的内存泄漏啦Q?br />边看代码边在?j)中鄙视q个猪小弟,该死的猪弟Q说你比猪笨Q猪觉得q是对自q侮i都不乐意Q?br />很多?j)得哦,慢慢整理出来?br />先说说JDBC吧?br /><strong>不关闭Connection</strong><br /><div><span id="wmqeeuq" class="Apple-style-span" style="font-weight: normal; ">q是最常见的错误,数据库增删改操作后,没有关闭数据库连接,D占用大量内存Q如果是用连接池Q那么系l很快就木有可用的数据库q接?jin);如果是直接连接数据库Q很快系l内存就耗尽?jin),要知道数据库q接很费资源的,否则要连接池q吗Q而且q种错误很难查,一个系l上百个DB操作Q就一个没关闭Q惨?jin)?/span><br /><strong>不关闭Statement,ResultSet</strong><br /><div><div style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">q是另一U错误,数据库连接关闭了(jin)Q但是Statement,ResultSet没关闭。谁说的关闭?jin)数据库q接其它?yu)׃用关闭的。只关闭q接Q那些Statement,ResultSet如同孤坟野g样占据你的HeapQ而且q是阴魂不散的说Q最后系l耗尽内存气绝w亡?/div></div><div><div style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><strong>频繁数据库连?/strong><br />大多C务系l,一个业务操作可能会(x)兌多张表的增删攏V麻?ch)不要每操作一张表Q就h一ơ数据库q接。麻?ch)把h数据库连接看做是请你学妹吃饭好不好,学妹很矜持Q请一ơ也不容易。这hQ你h数据库连接时Q就?x)}慎些Q尽可能一ơ数据库q接Q对多张表进行操作?br /><strong>l验</strong><br />不要把代码写成connection.close(); 或?nbsp;<span id="wmqeeuq" class="Apple-style-span" style="color: #333333; font-family: Arial; line-height: 26px; ">datasource.getConnection();把他们都装到工L(fng)里面Q这h试的时候加q去debug代码Q很Ҏ(gu)找到那个该ȝq接没有关闭?jin)。Statement, ResultSet也是q样?br /><br /></span>最后,猪小弟是谁?<br />呵呵Q猪弟?q前的我Q或者是8q前的我。当q_(d)q幼无知Q无知者无畏,犯下无数的错误,感谢老板Q感谢客P你们太有牺牲_?jin)?br /></div></div></div><img src ="http://www.aygfsteel.com/amenglai/aggbug/394386.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/amenglai/" target="_blank">amenglai</a> 2013-01-18 11:14 <a href="http://www.aygfsteel.com/amenglai/archive/2013/01/18/394386.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>使用Eclipse Memory Analyzer对Tomcatq行内存分析http://www.aygfsteel.com/amenglai/archive/2013/01/17/394346.htmlamenglaiamenglaiThu, 17 Jan 2013 02:55:00 GMThttp://www.aygfsteel.com/amenglai/archive/2013/01/17/394346.htmlhttp://www.aygfsteel.com/amenglai/comments/394346.htmlhttp://www.aygfsteel.com/amenglai/archive/2013/01/17/394346.html#Feedback0http://www.aygfsteel.com/amenglai/comments/commentRss/394346.htmlhttp://www.aygfsteel.com/amenglai/services/trackbacks/394346.html

试环境

Java Q?/span> JDK1.6

TomcatQ?/span> Tomcat 5.5

Eclipse Memory AnalyzerQ?/span>EMA 1.2.1Q直接去Eclipse下蝲Q无需安装哈)(j)

 

获得Heap Dump文g

Eclipse Memory Analyzer是针?/span>Heap Dump文gq行分析的,因此W一步就是要获得Heap Dump文g?/span>

步骤Q?/span>

获得U程ID?/span>启动jconsole.exe,?/span>位于jdk目录下的bin目录Q?/span>jconsole?/span>jdk自带的一个内存分析工P它提供了(jin)囑Ş界面。可以查看到被监控的jvm的内存(sh)息,U程信息Q类加蝲信息Q?/span>MBean信息?br />

此处我们可以扑ֈ需要检的Tomcat的线E?/span>ID?/span>

获得Heap Dump文g?/span>使用jmap来获?/span>Heap Dump文gQ命令行如下Q?/span>

jmap -dump:format=b,file=heap.bin 3888

此处3888Tomcat对应的线E?/span>ID

生成分析报告

启动MemoryAnalyzer.exeQ打开指定?/span>Heap Dump文g?/span>File -> Open Heap Dump

MAT针对指定?/span>Heap Dump文gq行分析Q生成内存泄露检报?br />


看懂分析报告

要想看懂EAT的报告,与其到网上去扑֐U神_(d)不如老老实实找本书Q先单复?fn)?/span>JVM?/span>Heap是怎么工作_(d)gc的大概一个工作机制。否?/span>EAT的报告就像天书一栗?/span>EAT只是工具Q不是目的?/span>



amenglai 2013-01-17 10:55 发表评论
]]>web应用中常出现的内存泄?/title><link>http://www.aygfsteel.com/amenglai/archive/2013/01/16/394286.html</link><dc:creator>amenglai</dc:creator><author>amenglai</author><pubDate>Wed, 16 Jan 2013 03:32:00 GMT</pubDate><guid>http://www.aygfsteel.com/amenglai/archive/2013/01/16/394286.html</guid><wfw:comment>http://www.aygfsteel.com/amenglai/comments/394286.html</wfw:comment><comments>http://www.aygfsteel.com/amenglai/archive/2013/01/16/394286.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/amenglai/comments/commentRss/394286.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/amenglai/services/trackbacks/394286.html</trackback:ping><description><![CDATA[企业U管理Y件的web应用和普通的web站点QB2C{有很大的不同。内存泄露的(g)查点也会(x)不同?br /><strong>(g)查点一Q什么信息需要缓存在session?/strong><br />在各U管理Y件中Q最常见的是把当前用L(fng)权限{信息缓存在session中。好啦,问题来了(jin)Q如果系l的权限很复杂:(x)操作权限Q管理权限,数据权限Q字D|限,巴拉巴拉一大堆的话Q那么把q大堆信息放到session中,一个用户就要占?0M+的内存。访问用户一多,pȝ挂?jin)。而且理软g一般都?x)把session的timeout讄的很多,除非用户手动的注销Q否则即使木有操作也?x)吊在系l上很久。因此要评估此部分的设计Q把不必要的或者访问不频繁的数据拖出sessionQ放qsession TA老h家吧?br /><strong>(g)查点二:(x)session数据传?br /></strong><div><span style="font-weight: normal; ">理pȝ很多都会(x)采用帧结构,常见的上帧查询条Ӟ下昄l果。问题来?jin),采用帧结构如果传递数据到面Q就要通过session。开发的时候,一般都是后台开发负责业务逻辑Q前台开发负责数据展C。前后开发一pQ后台向前台传递了(jin)一个集合对象,前台木有用,也不清除。这堆垃圾数据全部都ȝ内存Q所以系l跑着跑着宕Z(jin)?br /><div><strong>(g)查点三:(x)不要试图通过面来实现分?br /></strong><div style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><span style="font-weight: normal; ">理pȝ׃业务复杂性等要求Q大安把注意力首先攑֜实现业务功能上,有时Ҏ(gu)据的量不是很关注。有的系l刚开始好好的Q用着用着不不爽了(jin)Q原因就是数据量一增加Q很多相关的问题都会(x)暴露出来。最常见的是分页处理Q先把数据都取过来,在前台分|C。千万不要这P100条数据木有问题,1000条,10000条呢Q结果就是前台很忙,然后挂掉了(jin)?/span></div></div></span></div><img src ="http://www.aygfsteel.com/amenglai/aggbug/394286.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/amenglai/" target="_blank">amenglai</a> 2013-01-16 11:32 <a href="http://www.aygfsteel.com/amenglai/archive/2013/01/16/394286.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Oracle 11g 数据库连接池DBCP和Proxool性能Ҏ(gu)http://www.aygfsteel.com/amenglai/articles/394182.htmlamenglaiamenglaiMon, 14 Jan 2013 06:27:00 GMThttp://www.aygfsteel.com/amenglai/articles/394182.htmlhttp://www.aygfsteel.com/amenglai/comments/394182.htmlhttp://www.aygfsteel.com/amenglai/articles/394182.html#Feedback0http://www.aygfsteel.com/amenglai/comments/commentRss/394182.htmlhttp://www.aygfsteel.com/amenglai/services/trackbacks/394182.html背景

公司的品一直用的?/span>DBCP作ؓ(f)q接池。但是最q在客户环境发现当ƈ发增加时Q宕机鸟。已l对数据库查询进行了(jin)优化Q但是还是会(x)发生Tomcat宕机的情况,惛_更换数据库连接池?/span>

But换或者不换都要有数据佐证喽。因此着手测试对比?/span>

试环境

应用服务?/span>

Tomcat 5.5

试工具

JMete 2.8

数据?/span>

Oracle 11g

DBCP & Proxool

maxId

10

minId

5

试场景Q系l登录(一ơ登录操作需?/span>>14ơ的数据库连接操作)(j)


 

试l果Q?/span>20U内模拟50个进E@?/span>3?strong>Q?/strong>

DBCP

sampler_label

aggregate_report_count

average

aggregate_report_median

aggregate_report_90%_line

aggregate_report_min

aggregate_report_max

aggregate_report_rate

aggregate_report_bandwidth

login:HTTPh

150

6906

6262

13137

461

16022

3.071505

1.643735

M

150

6906

6262

13137

461

16022

3.071505

1.643735

proxool

sampler_label

aggregate_report_count

average

aggregate_report_median

aggregate_report_90%_line

aggregate_report_min

aggregate_report_max

aggregate_report_rate

aggregate_report_bandwidth

login:HTTPh

150

2959

3165

4620

8

5522

4.797083

5.380354

M

150

2959

3165

4620

8

5522

4.797083

5.380354

 

l论

1.         从以上测试结果看Q?/span>proxool的性能明显优(sh)DBCP?/span>

2.         另外针对Tomcat 5.5?/span>Tomcat 6.0也做?jin)测试,发?/span>Tomcat不同版本间的差异q不大,因此军_暂时不更换应用服务器?/span>

 

下一?/span>

利用jrockit分析pȝ内存泄露情况Q进行改q?/span>



amenglai 2013-01-14 14:27 发表评论
]]>
վ֩ģ壺 | ͻȪ| | ʯ| | | | ̩| | | | | ɽ| ̨| ڰ| ţ| | ߱| | ־| | ζ| | | | | ³ƶ| ʱ| ӱ| | | | ͷ| | ͨ| Դ| | ո| | | |