一套S2SH的应用,现用单线程,连续发1000个请求,用的DBCP链接池,结果报数据库链接不够用:
ERROR [org.hibernate.util.JDBCExceptionReporter] - Cannot get a connection, pool error Timeout waiting for idle object
在JAVA加上LOG:
log.info("active: " + dataSource.getNumActive() + " (max: "
+ dataSource.getMaxActive() + ") " + "idle: " + dataSource.getNumIdle()
+ "(max: " + dataSource.getMaxIdle() + ")");
结果显示为:
active: 25 (max: 100) idle: 0(max: 30)
active的数量一直增加,但idle的数量一直为0。当程序向链接池要链接的时候,如果池没有,就会新建一个,active数就会加1,关闭链接后,链接会返回池,idle数加1。idle为0则表示池里没有链接。
这样说明链接一直在创建,没有关闭放回池里。但链接是由SPRING和HIBERNATE管理的,代码中没有关闭链接的语句。之后试了N多配置,都还没解决,如增加maxActive数等。最后,加上这一行,问题才终于解决:
<prop key="hibernate.connection.release_mode">after_transaction</prop>
这里默认值是auto,如果是用JTA事务才适用,如果是JDBC事务,就只能用after_transaction。
这样每次事务结束后,就会关闭链接返回链接池。
ANDROID APP 与 WEB APP有相似之处,都是需要在容器内运行,都可以对事件进行响应。
WEB APP的核心组件是SERVLET,这是对游览器事件进行响应的一个类,事件有GET/POST等事件,不同的URL对应不同的SERVLET。
如果要输出不同的内容,则输出不同的HTML即可。
WEB APP的配置文件是WEB.XML,当容器启动时,会从这读取有多少个SERVLET。当浏览器发过来不同的URL请求时,会从中选择相应的SERVLET执行。
ANDROID APP的核心组件是ACTIVITY,这是一个对系统事件进行响应的一个类,事件有启动事件,菜单点击事件等,点击不同的地方对应不同的ACTIVITY。
如果要输出不同的内容,则输出不同的VIEW即可。
ANDROID APP的配置文件是MAINFRE.XML,当应用被部署到系统时,系统会从这读取有多少个ACTIVITY。当不同的事件发生时,系统会会从中选择相应的ACTIVITY执行。
The architecture representation will basically adopt the 4 + 1 View Model as
recommended, to organize the architectural description from different perspectives, each
of which addresses a specific set of concerns:
• Requirement View – describes the software requirements, functional and
non-functional, illustrated by significant use cases and scenarios.
• Logical View – describes the object model of the design, the system
decomposition into layers and subsystems, and the dependencies between them.
• Process View – describes the concurrency and synchronization aspects of the
design.
• Implementation View – describes the software’s static organization in the
development environment.
• Deployment View – describes the mapping of the software onto hardware.
• Data View – describes the database design for the software.
It allows various stakeholders to find what they need in the software architecture. System
engineers can approach it from the logical view, process view and deployment view. DBA
can approach it from the data view. Project managers and software configuration
managers can approach it from the development view.
Demo:
- CUHK RFID - White Paper

- Middleware Quick Start Guide

- Tag Capturer Quick Start Guide

- Middleware System Design Document

- Tag Capturer System Design Document

- Middleware Test Cases

- Middleware Test Plan

- Middleware Source Code

|
数据导出:
1 将数据库TEST完全导出,用户名system 密码manager 导出到D:\daochu.dmp中
exp system/manager@TEST file=d:\daochu.dmp full=y
2 将数据库中system用户与sys用户的表导出
exp system/manager@TEST file=d:\daochu.dmp owner=(system,sys)
3 将数据库中的表table1 、table2导出
exp system/manager@TEST file=d:\daochu.dmp tables=(table1,table2)
4 将数据库中的表table1中的字段filed1以"00"打头的数据导出
exp system/manager@TEST file=d:\daochu.dmp tables=(table1)query=\" where filed1 like '00%'\"
上面是常用的导出,对于压缩我不太在意,用winzip把dmp文件可以很好的压缩。
不过在上面命令后面 加上 compress=y 就可以了
数据的导入
1 将D:\daochu.dmp 中的数据导入 TEST数据库中。
imp system/manager@TEST file=d:\daochu.dmp
上面可能有点问题,因为有的表已经存在,然后它就报错,对该表就不进行导入。
在后面加上 ignore=y 就可以了。
2 将d:\daochu.dmp中的表table1 导入
imp system/manager@TEST file=d:\daochu.dmp tables=(table1)
基本上上面的导入导出够用了。不少情况我是将表彻底删除,然后导入。
注意:
你要有足够的权限,权限不够它会提示你。
数据库时可以连上的。可以用tnsping TEST 来获得数据库TEST能否连上
附录一:
给用户增加导入数据权限的操作
第一,启动sql*puls
第二,以system/manager登陆
第三,create user 用户名 IDENTIFIED BY 密码 (如果已经创建过用户,这步可以省略)
第四,GRANT CREATE USER,DROP USER,ALTER USER ,CREATE ANY VIEW ,
DROP ANY VIEW,EXP_FULL_DATABASE,IMP_FULL_DATABASE,
DBA,CONNECT,RESOURCE,CREATE SESSION TO 用户名字
第五, 运行-cmd-进入dmp文件所在的目录,
imp userid=system/manager full=y file=*.dmp
或者 imp userid=system/manager full=y file=filename.dmp
安装oracle9I
Szportdb\szportdb\szportdb
用sysdba 登录建立用户:szportdb 表空间可以自己设定,也可以Users
倒入数据库。
Imp szportdb/szportdb@szportdb full=y C:\szportdb.dmp ignore=