日期:2014-05-16  浏览次数:20504 次

使用Spring的jdbcTemplate进一步简化JDBC操作

先看applicationContext.xml配置文件:


<!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><?xml?version="1.0"?encoding="UTF-8"?>
<beans?xmlns="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">

????
<bean?id="springDSN"
????????class
="org.springframework.jdbc.datasource.DriverManagerDataSource">
????????
<property?name="driverClassName"
????????????value
="com.microsoft.jdbc.sqlserver.SQLServerDriver">
????????
</property>
????????
<property?name="url"
????????????value
="jdbc:microsoft:sqlserver://localhost:1433;databasename=bbs">
????????
</property>
????????
<property?name="username"?value="sa"></property>
????????
<property?name="password"?value="sa"></property>
????
</bean><