- 浏览: 216817 次
- 性别:
- 来自: 湖南
文章分类
- 全部博客 (94)
- jQuery实例 (2)
- 数据库篇章 (13)
- Java杂谈 (5)
- SSH技术 (33)
- 工作流 (3)
- ajax技术 (2)
- Web前端 (13)
- Struts2 笔记 (1)
- Struts1 笔记 (0)
- 软件面试题目 (0)
- DWR技术篇章 (4)
- 智力题集 (4)
- 正则表达式 (3)
- C语言经典实例 (10)
- C语言学习 (1)
- ibatis and lucene (2)
- jsp_javascript (5)
- 单个功能模块实现源码 (2)
- jsp网站 (1)
- Linux (1)
- 文件解析 (5)
- 各种分页方法 (3)
- android (0)
- XML 技术 (1)
- HTTP通信 & XML (0)
- springMVC (0)
- 平台框架 (1)
最新评论
-
aiwei:
可不可以解释一下每个参数的意思?看不明白啊
Java 动态加载jsp页面 在div 刷新这么简单 就可以实现了 -
hzau_chen:
:i
很强大的jsp手写分页插件 实现json 等一些ajax技术 联合查询 模糊查询 条件查询 -
yzz9i:
你想怎么操作?这个是可以直接使用的
jsp里面实现 注册成功后 系统自动发送电子邮件 -
Zhang987526341:
我想请问在数据库里面还要加字段什么的吗,
jsp里面实现 注册成功后 系统自动发送电子邮件 -
tlk20071:
我现在要写一个类似的东西,但是一点都不熟悉,你能不能帮忙讲解一 ...
一个简单功能强大的Google Map 搜索源码 【我在CSDN上也有发布】
给配置了c3p0的application.xml 配置一个单独的连接文件 applicationContext.xml 数据库连接就不要老是该来改去了
原本的applicationContext.xml 部分配置()如下:
现在的配置如下:
1:
2:加里一个 init.properties 文件在src 目录下 跟applicationContext统一目录
文件配置:
driverName=com.p6spy.engine.spy.P6SpyDriver
dataSource.url=jdbc:mysql://localhost:3306/sms?useUnicode=true&characterEncoding=UTF-8
dataSource.username=root
dataSource.password=admin
hibernate.show_sql =true
这样在开发的过程中 applicationContext.xml 配置文件的数据库连接就不要老是该来改去了
<?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:util="http://www.springframework.org/schema/util" xmlns:p="http://www.springframework.org/schema/p" 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.0.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd"> <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close"> <property name="driverClass"> <!-- <value>com.mysql.jdbc.Driver</value> --> <value>com.p6spy.engine.spy.P6SpyDriver</value> </property> <property name="jdbcUrl"> <value>jdbc:mysql://localhost:3306/sms?useUnicode=true&characterEncoding=UTF-8</value> </property> <property name="user"> <value>root</value> </property> <property name="password"> <value>admin</value> </property> <!--连接池中保留的最小连接数。--> <property name="minPoolSize"> <value>5</value> </property> <!--连接池中保留的最大连接数。Default: 15 --> <property name="maxPoolSize"> <value>30</value> </property> <!--初始化时获取的连接数,取值应在minPoolSize与maxPoolSize之间。Default: 3 --> <property name="initialPoolSize"> <value>10</value> </property> <!--最大空闲时间,60秒内未使用则连接被丢弃。若为0则永不丢弃。Default: 0 --> <property name="maxIdleTime"> <value>60</value> </property> <!--当连接池中的连接耗尽的时候c3p0一次同时获取的连接数。Default: 3 --> <property name="acquireIncrement"> <value>5</value> </property> <!--JDBC的标准参数,用以控制数据源内加载的PreparedStatements数量。但由于预缓存的statements 属于单个connection而不是整个连接池。所以设置这个参数需要考虑到多方面的因素。 如果maxStatements与maxStatementsPerConnection均为0,则缓存被关闭。Default: 0--> <property name="maxStatements"> <value>0</value> </property> <!--每60秒检查所有连接池中的空闲连接。Default: 0 --> <property name="idleConnectionTestPeriod"> <value>60</value> </property> <!--定义在从数据库获取新连接失败后重复尝试的次数。Default: 30 --> <property name="acquireRetryAttempts"> <value>30</value> </property> <!--获取连接失败将会引起所有等待连接池来获取连接的线程抛出异常。但是数据源仍有效 保留,并在下次调用getConnection()的时候继续尝试获取连接。如果设为true,那么在尝试 获取连接失败后该数据源将申明已断开并永久关闭。Default: false--> <property name="breakAfterAcquireFailure"> <value>true</value> </property> <!--因性能消耗大请只在需要的时候使用它。如果设为true那么在每个connection提交的 时候都将校验其有效性。建议使用idleConnectionTestPeriod或automaticTestTable 等方法来提升连接测试的性能。Default: false --> <property name="testConnectionOnCheckout"> <value>false</value> </property> </bean> <bean id="sessionFactory"。。。
现在的配置如下:
1:
<?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:util="http://www.springframework.org/schema/util" xmlns:p="http://www.springframework.org/schema/p" 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.0.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd"> <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="locations"> <list><value>classpath:init.properties</value></list> </property> <property name="fileEncoding" value="utf-8" /> </bean> <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close"> <property name="driverClass"> <!-- <value>com.mysql.jdbc.Driver</value> --> <value>${driverName}</value> </property> <property name="jdbcUrl"> <value>${dataSource.url}</value> </property> <property name="user"> <value>${dataSource.username}</value> </property> <property name="password"> <value>${dataSource.password}</value> </property> <!--连接池中保留的最小连接数。--> <property name="minPoolSize"> <value>5</value> </property> <!--连接池中保留的最大连接数。Default: 15 --> <property name="maxPoolSize"> <value>30</value> </property> <!--初始化时获取的连接数,取值应在minPoolSize与maxPoolSize之间。Default: 3 --> <property name="initialPoolSize"> <value>10</value> </property> <!--最大空闲时间,60秒内未使用则连接被丢弃。若为0则永不丢弃。Default: 0 --> <property name="maxIdleTime"> <value>60</value> </property> <!--当连接池中的连接耗尽的时候c3p0一次同时获取的连接数。Default: 3 --> <property name="acquireIncrement"> <value>5</value> </property> <!--JDBC的标准参数,用以控制数据源内加载的PreparedStatements数量。但由于预缓存的statements 属于单个connection而不是整个连接池。所以设置这个参数需要考虑到多方面的因素。 如果maxStatements与maxStatementsPerConnection均为0,则缓存被关闭。Default: 0--> <property name="maxStatements"> <value>0</value> </property> <!--每60秒检查所有连接池中的空闲连接。Default: 0 --> <property name="idleConnectionTestPeriod"> <value>60</value> </property> <!--定义在从数据库获取新连接失败后重复尝试的次数。Default: 30 --> <property name="acquireRetryAttempts"> <value>30</value> </property> <!--获取连接失败将会引起所有等待连接池来获取连接的线程抛出异常。但是数据源仍有效 保留,并在下次调用getConnection()的时候继续尝试获取连接。如果设为true,那么在尝试 获取连接失败后该数据源将申明已断开并永久关闭。Default: false--> <property name="breakAfterAcquireFailure"> <value>true</value> </property> <!--因性能消耗大请只在需要的时候使用它。如果设为true那么在每个connection提交的 时候都将校验其有效性。建议使用idleConnectionTestPeriod或automaticTestTable 等方法来提升连接测试的性能。Default: false --> <property name="testConnectionOnCheckout"> <value>false</value> </property> </bean> <bean id="sessionFactory"。。。
2:加里一个 init.properties 文件在src 目录下 跟applicationContext统一目录
文件配置:
引用
driverName=com.p6spy.engine.spy.P6SpyDriver
dataSource.url=jdbc:mysql://localhost:3306/sms?useUnicode=true&characterEncoding=UTF-8
dataSource.username=root
dataSource.password=admin
hibernate.show_sql =true
这样在开发的过程中 applicationContext.xml 配置文件的数据库连接就不要老是该来改去了
发表评论
-
Java在项目中怎么让系统运行的更快,其实有好多方法 下面主要写到怎么运用系统级缓存
2012-02-08 17:11 0下面代码就已开发的系统为例子,也给自己学习学习。 ... -
(JAVA)未登录获取系统数据,例如一些公告之类的展示数据
2012-01-14 15:30 898在jsp页面上可以 通过Java代码得到 。 <% ... -
Java 中怎么发送 Email 邮件
2012-01-11 14:47 2539下面是我写的一段发生 ... -
Java 中实现定时服务 在ssh框架中跟普通工程里面创建的方式,区别
2012-01-11 14:33 1149闲话不多说 直接看下面代码 引用 网上这么说的: 1、 S ... -
Java 方便调用的工具类
2012-01-09 19:01 1656//时间格式化 (string型转date型 date转s ... -
Java 里面怎么发送XML数据请求 和怎么处理返回的XML数据
2012-01-04 15:33 0设计了几个关键地方:1 怎么发送请(发送有那些参数,参数怎么处 ... -
创建系统参数 (实例化参数)
2011-12-15 15:45 1147参数文件 引用qnr.properties 之中属性:ex ... -
MySQL存储过程 AND 在JAVA中的程序调用
2011-12-14 11:09 1527一、创建MySQL存储过程示例 下面是具体的创建过程: ... -
Exception in thread "main":com/sun/mail/util/LineInputStream
2011-12-07 16:00 987经过摸索,问题终于解决了。大家 MyEclipse6.5的j ... -
IO 流读取文件时候出现乱码 文件编码格式问题 怎么转换解决方法
2011-11-08 12:18 4464在使用下面这个写法时候UTF-8文件编码 在读取时候出现乱码问 ... -
很强大的jsp手写分页插件 实现json 等一些ajax技术 联合查询 模糊查询 条件查询
2011-10-13 10:02 11111这个插件里面分页功能很强大,调用者只需赋几个值就可以了。 下 ... -
Java 动态加载jsp页面 在div 刷新这么简单 就可以实现了
2011-09-29 17:43 11889引用 <script type="text/j ... -
注释方式 类生成数据库表
2011-09-21 17:24 909类对象: package com.pojos; im ... -
c:foreach 中jsp页面 中怎么对时间类型进行格式化问题
2011-09-14 12:00 7582具体实现很简单 就两步走: 引用 <%@ taglib ... -
dao 分页方法
2011-09-01 16:05 1296看看这个类很简单实用: public Map feny ... -
ssh 整合 中怎么使用 c3p0 链接池 经测试已成功 不受 hibernate的8小时限制
2011-08-30 09:44 1365实现方式很简单,只操作 applicationContex ... -
怎么控制 显示 DIV 里面的 字数 只显示部分文字
2011-08-29 09:19 4204在 DIV 里面加如下 样式就可以了。 <div st ... -
FCKeditor 在jsp [ssh 框架中]中怎么调用 实现 图片上传/文件浏览【自己看文档摸索出来的】跟大家一块分享
2011-08-25 14:58 22761:下载 解压FCKeditor_2.6.4.1.zip ... -
使用 过滤器 filter处理session超时问题
2011-08-24 16:11 1474新建一个过滤器命名为:FilterDemo,该类继承自:jav ... -
最好用 最简单的日期时间javascript代码
2011-08-19 16:49 899<script>setInterval(&quo ...
相关推荐
applicationContext.xml 详细配置
struts.xml和applicationContext.xml、web.xml的配置
这是一些配置文件,可以作为参考,个人感觉很方便的学习方法
包含applicationContext.xml、db.properties、log4j.properties、spring-mvc.xml文件,方便搭建,省去写代码。。
SSH框架applicationContext.xml头部文件
使用myeclipse8.5搭建SSH后,将struts.xml和applicationContext.xml移动到别的地方,示例中为webroot下的config文件夹中,web.xml中需要做的修改示例。其中对于返回上一层方式不同的myeclipse可能不同,如有的用../...
Spring applicationContext.xml常见部分属性的使用备注
applicationContext.xml详解
ssh框架事务管理applicationContext.xml配置文件
spring+jpa的applicationContext.xml配置
ssm框架基础配置文件,不需要自己每次都手动敲,拿来即用,注意修改少数几个路径,超级方便。
applicationContext.xml完美配置
Spring Boot技术知识点:如何读取不同路径里的applicationContext.xml配置文件4
详解Spring的applicationContext.xml文件代码:
本篇文章主要介绍了详解spring applicationContext.xml 配置文件 ,小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧