Skip to content

Instantly share code, notes, and snippets.

@yanhua365
Created November 26, 2013 07:52
Show Gist options
  • Save yanhua365/7654771 to your computer and use it in GitHub Desktop.
Save yanhua365/7654771 to your computer and use it in GitHub Desktop.
Spring JPA中的各种数据库连接配置
<!-- H2的混合模式 -->
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="org.h2.Driver" />
<!--<property name="url" value="jdbc:h2:~/databases/mydb" />-->
<property name="url" value="jdbc:h2:file://D:\h2\mydb;AUTO_SERVER=TRUE;USER=SA;" />
</bean>
<!-- H2的内存模式 -->
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="org.h2.Driver" />
<property name="url" value="jdbc:h2:mem:mydb;USER=SA;" />
</bean>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment