1.连接sqlserver2005/2008数据库
<bean id="dataSource" class="org.apache.tomcat.dbcp.dbcp2.BasicDataSource">
<property name="driverClassName"
value="com.microsoft.sqlserver.jdbc.SQLServerDriver"></property>
<property name="url"
value="jdbc:sqlserver://192.168.85.128:1433;DatabaseName=mydatabase"></property>
<!--DatabaseName是你自己的数据库名称 -->
<property name="username" value="sa"></property>
<property name="password" value="fjg"></property>
</bean>
2.连接oracle数据库
<!-- oracle连接 -->
<bean id="dataSource"
class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName"
value="oracle.jdbc.OracleDriver">
</property>
<property name="url"
value="jdbc:oracle:thin:@192.168.16.115:1521:orcl">
</property>
<property name="username" value="fjg"></property>
<property name="password" value="fjg"></property>
</bean>
网友评论