日期:2014-05-16 浏览次数:20616 次
?? Apache FtpServer数据库管理用户实现步骤
?
? 一? Proxool连接池配置
?
dbc.driverClassName=com.mysql.jdbc.Driver jdbc.url=jdbc\:mysql\://127.0.0.1\:3306/study jdbc.username=root jdbc.password=root ##数据库别名 jdbc.alias =study ##最大连接数 jdbc.maximum-connection-count=50 ##最小连接数 jdbc.minmum-connection-conunt =5 ##housekeeper检测到某个线程的活动时间大于这个数值.它将会杀掉这个线程默认是5分钟. jdbc.maximum-active-time=50000 ##house keeper 保留线程处于睡眠状态的最长时间,house keeper 的职责就是检查各个连接的状态,并判断是否需要销毁或者创建 jdbc.house-keeping-sleep-time=30000 ##一个线程的最大寿命 jdbc.maximum-connection-lifetime=60000 ##可用连接的最小数量 jdbc.prototype-count=2 ##发现了空闲的数据库连接.house keeper 将会用这个语句来测试 jdbc.house-keeping-test-SQL=SELECT CURRENT_DATE ##连接池使用状况统计。 参数“10s,1m,1d” jdbc.statistics=10s,1m,1d ## 详细信息设置 jdbc.verbose=true ##打印sql jdbc.trace=true ##日志 jdbc.statistics-log-level=DEBUG jdbc.simultaneous-build-throttle=1 jdbc.overload-wIThout-refusal-lifetime=10000 jdbc.fatal-SQL-exception=ORA-1234
?
二? Spring配置文件
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd" default-lazy-init="false"> <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="locations"> <value>classpath:jdbc.properties</value> </property> </bean> </beans>
?三 Apache FtpServer server集成到Spring中,在Spring配置文件加入如下代码
?
<server xmlns="http://mina.apache.org/ftpserver/spring/v1" xmlns:beans="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://mina.apache.org/ftpserver/spring/v1 http://mina.apache.org/ftpserver/ftpserver-1.0.xsd " id="myUserServer" max-logins="500" anon-enabled="false" max-anon-logins="10" max-login-failures="3" login-failure-delay="500"> <listeners> <nio-listener name="default" port="21"> <ssl> <keystore file="/ftpserver/ftpserver.jks" password="password" /> </ssl> </nio-listener> </listeners> <ftplets> <ftplet name="ftplet1"> <beans:bean class="com.dt.ftp.server.MyFtplet" /> </ftplet> </ftplets> </server>
?
四 数据库管理配置,在Server元素里加入如下配置代码
?
?
<db-user-manager encrypt-passwords="clear"> <data-source> <beans:bean class="org.logicalcobwebs.proxool.ProxoolDataSource"> <beans:property name="driver" value="${jdbc.driverClassName}" /> <beans:property name="driverUrl" value="${jdbc.url}" /> <beans:property name="user" value="${jdbc.username}" /> <beans:property name="password" value="${jdbc.password}" /> <beans:property name="alias" value="${jdbc.alias}" /> <beans:property name="minimumConnectionCount" value="${jdbc.minmum-connection-conunt}" /> <beans:property