@S2JH 你好,想跟你请教个问题:我想在mysql数据库上演示你的prototype,如何修改数据库配置,弄了好久没有成功,能不能详细解答一下,非常的感谢。还有多项目依赖那个开发有相关资料吗,我参考一下
http://git.oschina.net/xautlx/s2jh/wikis/DevCfg
<bean id="dataSourceSpied" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> <property name="driverClassName" value="com.mysql.jdbc.Driver" /> <property name="url" value="jdbc:mysql://localhost:3306/s2jh" /> <property name="username" value="root" /> <property name="password" value="root" /> <!-- Connection Pooling Info --> <property name="initialSize" value="1" /> <property name="maxActive" value="3" /> <property name="minIdle" value="1" /> <property name="maxIdle" value="5" /> <property name="maxWait" value="30000" /> <property name="removeAbandoned"> <value>true</value> </property> <property name="removeAbandonedTimeout"> <value>180</value> </property> <property name="poolPreparedStatements" value="false" /> <property name="defaultAutoCommit" value="true" /> </bean> 改掉上面的配置,quartz改成mysql。差不多了
</bean>
改掉上面的配置,quartz改成mysql。差不多了
<?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:jdbc="http://www.springframework.org/schema/jdbc" xmlns:jee="http://www.springframework.org/schema/jee" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.1.xsd http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.1.xsd" default-lazy-init="false"> <beans profile="development"> <!-- 缺省PropertyPlaceholder定义 --> <bean class="lab.s2jh.ctx.ExtPropertyPlaceholderConfigurer"> <property name="locations"> <list> <value>classpath:/application.properties</value> <value>classpath:/application_prd.properties</value> </list> </property> <property name="ignoreResourceNotFound" value="true" /> <property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE" /> </bean> <!-- H2文件模式数据库,实际开发替换成其他MySQL、Oracle等数据库配置即可,注意别忘了在pom.xml中添加对应数据库驱动的依赖 --> <bean id="dataSourceSpied" class="org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseFactoryBean"> <property name="databaseName" value="${user.dir}/h2/prototype" /> <property name="databaseConfigurer"> <bean class="lab.s2jh.core.dao.h2.H2EmbeddedFileDatabaseConfigurer" /> </property> </bean> <!-- 定制log4jdbc做一些输出SQL信息的微调 --> <bean id="extSlf4jSpyLogDelegator" class="lab.s2jh.core.dao.log4jdbc.ExtSlf4jSpyLogDelegator" /> <!-- 用log4jdbc对datasouce进行包裹实现完整的SQL语句跟踪 --> <bean id="dataSource" class="net.sf.log4jdbc.Log4jdbcProxyDataSource" depends-on="extSlf4jSpyLogDelegator"> <constructor-arg> <ref bean="dataSourceSpied" /> </constructor-arg> </bean> <jdbc:initialize-database data-source="dataSource" ignore-failures="ALL" enabled="${jdbc.initialize.database.enable}"> <jdbc:script location="classpath:sql/ddl/quartz/tables_h2.sql" encoding="UTF-8" /> <jdbc:script location="classpath:sql/data/t_sys_data_dict.sql" encoding="UTF-8" /> <jdbc:script location="classpath:sql/data/t_sys_menu.sql" encoding="UTF-8" /> <jdbc:script location="classpath:sql/data/t_auth_privilege.sql" encoding="UTF-8" /> <jdbc:script location="classpath:sql/data/t_auth_role.sql" encoding="UTF-8" /> <jdbc:script location="classpath:sql/data/t_auth_department.sql" encoding="UTF-8" /> <jdbc:script location="classpath:sql/data/t_auth_user.sql" encoding="UTF-8" /> <jdbc:script location="classpath:sql/data/t_auth_user_r2_role.sql" encoding="UTF-8" /> <jdbc:script location="classpath:sql/data/t_sys_pub_post.sql" encoding="UTF-8" /> <jdbc:script location="classpath:sql/data/biz_finance_account_subject.sql" encoding="UTF-8" /> </jdbc:initialize-database> <bean id="mockDataGenerator" class="lab.s2jh.biz.util.MockDataGenerator" init-method="initializeDatabase"> <property name="enabled" value="${jdbc.initialize.database.enable}" /> <property name="entityManagerFactory" ref="entityManagerFactory" /> <property name="transactionManager" ref="transactionManager" /> </bean> <import resource="classpath:/service/spring*.xml" /> </beans> <beans profile="production"> <!-- 缺省PropertyPlaceholder定义 --> <bean class="lab.s2jh.ctx.ExtPropertyPlaceholderConfigurer"> <property name="locations"> <list> <value>classpath:/application.properties</value> <value>classpath:/application_prd.properties</value> </list> </property> <property name="ignoreResourceNotFound" value="true" /> <property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE" /> </bean> <jee:jndi-lookup id="dataSourceSpied" jndi-name="java:comp/env/jdbc/s2jh" /> <!-- 定制log4jdbc做一些输出SQL信息的微调 --> <bean id="extSlf4jSpyLogDelegator" class="lab.s2jh.core.dao.log4jdbc.ExtSlf4jSpyLogDelegator" /> <!-- 用log4jdbc对datasouce进行包裹实现完整的SQL语句跟踪 --> <bean id="dataSource" class="net.sf.log4jdbc.Log4jdbcProxyDataSource" depends-on="extSlf4jSpyLogDelegator"> <constructor-arg> <ref bean="dataSourceSpied" /> </constructor-arg> </bean> <jdbc:initialize-database data-source="dataSource" ignore-failures="ALL" enabled="${jdbc.initialize.database.enable}"> <jdbc:script location="classpath*:sql/ddl/quartz/tables_mysql.sql" encoding="UTF-8" /> <jdbc:script location="classpath:sql/data/t_sys_data_dict.sql" encoding="UTF-8" /> <jdbc:script location="classpath:sql/data/t_sys_menu.sql" encoding="UTF-8" /> <jdbc:script location="classpath:sql/data/t_auth_privilege.sql" encoding="UTF-8" /> <jdbc:script location="classpath:sql/data/t_auth_role.sql" encoding="UTF-8" /> <jdbc:script location="classpath:sql/data/t_auth_user.sql" encoding="UTF-8" /> <jdbc:script location="classpath:sql/data/t_auth_user_r2_role.sql" encoding="UTF-8" /> <jdbc:script location="classpath:sql/data/t_sys_pub_post.sql" encoding="UTF-8" /> </jdbc:initialize-database> <import resource="classpath:/service/spring*.xml" /> </beans> <!-- 用于Unit Test配置 --> <beans profile="test"> <!-- 缺省PropertyPlaceholder定义 --> <bean class="lab.s2jh.ctx.ExtPropertyPlaceholderConfigurer"> <property name="locations"> <list> <value>classpath:/application.properties</value> <value>classpath:/application-test.properties</value> </list> </property> <property name="ignoreResourceNotFound" value="true" /> <property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE" /> </bean> <!-- 嵌入式内存中数据库 --> <jdbc:embedded-database id="dataSourceSpied" type="H2"> <jdbc:script location="classpath:sql/ddl/quartz/tables_h2.sql" encoding="UTF-8" /> </jdbc:embedded-database> <bean id="dataSource" class="net.sf.log4jdbc.Log4jdbcProxyDataSource"> <constructor-arg> <ref bean="dataSourceSpied" /> </constructor-arg> </bean> </beans> </beans>
具体可以把异常信息发出来看看。最近在尝试在另外一个平台部署mysql版本演示。
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
暂无简介
文章 0 评论 0
接受
发布评论
评论(4)
参考:MySQL数据库配置说明
http://git.oschina.net/xautlx/s2jh/wikis/DevCfg
具体可以把异常信息发出来看看。最近在尝试在另外一个平台部署mysql版本演示。