6 个解决方案
#1
驱动改成oracle 的,参考。
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"
destroy-method="close">
<property name="driverClass" value="oracle.jdbc.driver.OracleDriver" />
<property name="jdbcUrl" value="jdbc:oracle:thin:@192.168.24.102:1521:sms " />
<property name="user" value="test" />
<property name="password" value="test" />
</bean>
#2
没懂啊,我原来有连接oracle的,现在需要再连接一个sql server,连接sql server不是要sql的驱动?
#4
原理是一样的,连接oracle也需要驱动的。改下配置jdbc的文件,然后把sqlserver驱动导入即可。
#5
beans.xml
[html] view plaincopyprint?
<bean id="dataSource" destroy-method="close"
class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName"
value="${jdbc.driverClassName}" />
<property name="url" value="${jdbc.url}" />
<property name="username" value="${jdbc.username}" />
<property name="password" value="${jdbc.password}" />
</bean>
jdbc.properties:
jdbc.driverClassName=com.microsoft.sqlserver.jdbc.SQLServerDriver
jdbc.url=jdbc:sqlserver://localhost:1434;database=selfStudySystem;integratedSecurity=false
jdbc.username=sa
jdbc.password=root
[html] view plaincopyprint?
<bean id="dataSource" destroy-method="close"
class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName"
value="${jdbc.driverClassName}" />
<property name="url" value="${jdbc.url}" />
<property name="username" value="${jdbc.username}" />
<property name="password" value="${jdbc.password}" />
</bean>
jdbc.properties:
jdbc.driverClassName=com.microsoft.sqlserver.jdbc.SQLServerDriver
jdbc.url=jdbc:sqlserver://localhost:1434;database=selfStudySystem;integratedSecurity=false
jdbc.username=sa
jdbc.password=root
#6
<bean id="dataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="net.sourceforge.jtds.jdbc.Driver" />
<property name="url"
value="jdbc:jtds:sqlserver://192.168.0.213:1433;DatabaseName=teenysoftCard;instance="/>
<property name="username" value="sa" />
<property name="password" value="" />
</bean>
下载一个jtds驱动包
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="net.sourceforge.jtds.jdbc.Driver" />
<property name="url"
value="jdbc:jtds:sqlserver://192.168.0.213:1433;DatabaseName=teenysoftCard;instance="/>
<property name="username" value="sa" />
<property name="password" value="" />
</bean>
下载一个jtds驱动包
#1
驱动改成oracle 的,参考。
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"
destroy-method="close">
<property name="driverClass" value="oracle.jdbc.driver.OracleDriver" />
<property name="jdbcUrl" value="jdbc:oracle:thin:@192.168.24.102:1521:sms " />
<property name="user" value="test" />
<property name="password" value="test" />
</bean>
#2
没懂啊,我原来有连接oracle的,现在需要再连接一个sql server,连接sql server不是要sql的驱动?
#3
#4
原理是一样的,连接oracle也需要驱动的。改下配置jdbc的文件,然后把sqlserver驱动导入即可。
#5
beans.xml
[html] view plaincopyprint?
<bean id="dataSource" destroy-method="close"
class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName"
value="${jdbc.driverClassName}" />
<property name="url" value="${jdbc.url}" />
<property name="username" value="${jdbc.username}" />
<property name="password" value="${jdbc.password}" />
</bean>
jdbc.properties:
jdbc.driverClassName=com.microsoft.sqlserver.jdbc.SQLServerDriver
jdbc.url=jdbc:sqlserver://localhost:1434;database=selfStudySystem;integratedSecurity=false
jdbc.username=sa
jdbc.password=root
[html] view plaincopyprint?
<bean id="dataSource" destroy-method="close"
class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName"
value="${jdbc.driverClassName}" />
<property name="url" value="${jdbc.url}" />
<property name="username" value="${jdbc.username}" />
<property name="password" value="${jdbc.password}" />
</bean>
jdbc.properties:
jdbc.driverClassName=com.microsoft.sqlserver.jdbc.SQLServerDriver
jdbc.url=jdbc:sqlserver://localhost:1434;database=selfStudySystem;integratedSecurity=false
jdbc.username=sa
jdbc.password=root
#6
<bean id="dataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="net.sourceforge.jtds.jdbc.Driver" />
<property name="url"
value="jdbc:jtds:sqlserver://192.168.0.213:1433;DatabaseName=teenysoftCard;instance="/>
<property name="username" value="sa" />
<property name="password" value="" />
</bean>
下载一个jtds驱动包
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="net.sourceforge.jtds.jdbc.Driver" />
<property name="url"
value="jdbc:jtds:sqlserver://192.168.0.213:1433;DatabaseName=teenysoftCard;instance="/>
<property name="username" value="sa" />
<property name="password" value="" />
</bean>
下载一个jtds驱动包