当前位置:文档之家› spring与各种数据库连接配置及驱动

spring与各种数据库连接配置及驱动

v/bean>
4. MySQL
vbean id="dataSource" class="mons.dbcp.BasicDataSource" Destroy-method="close">
vproperty name="driverClassName" value="com.mysql.jdbc.Driver" />
vproperty name="url" value="jdbc:mysql:〃localhost:3309/sampledb"/> vpropertyname="username" value="test"/> vproperty name="password" value="test"/> v/bean>
Spring
1. Oracle
vbean id="dataSource" class="mons.dbcp.BasicDataSourcei" destroy-method="close">
vproperty name="driverClassName" value="oracle.jdbc.driver.OracleDriver"/> vproperty name="url" value="jdbc:oracle:thin:@localhost:1521:orcl" /> vproperty name="username" value="test"/>
vproperty name="password" value="test"/> v/bean>
value="jdbc:Microsoft:sqlserver:〃localhost:1433;DatabaseName=testDB"/> vproperty name="username" value="test" /> vproperty name="password" value="test" />
5. HSQLDB
vbean id="dataSource" class="mons.dbcp.BasicDataSource" Destroy-method="close">
vproperty name="driverClassName" value="org.hsqldb.jdbcDriver"/> vproperty name="url" value="jdbc:hsqldb:hsql:〃localhost:9902"/> vproperty name="username" value="test"/>
vproperty name="password" value="test"/>
v/bean>
2. DB2
vbeanቤተ መጻሕፍቲ ባይዱid="dataSource" class="mons.dbcpBasicDataSource" Destroy-method="close">
vproperty name="driverClassName" value="com.ibm.db2.app.DB2Driver"/> vproperty name="url" value="jdbc:db2//localhost:5000/testDB"/> vproperty name="username" value="test"/>
vproperty name="password" value="test"/>
v/bean>
3. SQL Server
vbean id="dataSource" class="mons.dbcp.BasicDataSource"
Destroy-method="close"> vproperty name="driverClassName" value="com.microsoft.jdbc.sqlserver.SQLServerDriver"/> vproperty name="url"
相关主题