主题 : sql2005数据库链接问题!!!!!急!!! |
级别: 白丁
|
1# 发表于:2010-11-15 09:43:51 IP:60.233.*.*
|
||||
---|---|---|---|---|---|
级别: 童生
|
2# 发表于:2010-11-15 09:53:41 IP:115.251.*.*
连接数据库的URL不正确,密码不正确,用户名不正确,数据库已经关闭,这几种情况都会抛出那个错误。
|
||
---|---|---|---|
级别: 童生
|
4# 发表于:2010-11-15 10:06:01 IP:115.251.*.*
您看看是不是hibernate配置文件的问题。
把xml文件里面的 <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"> <property name="driverClassName"> <value>net.sourceforge.jtds.jdbc.Driver</value> </property> </bean> ...... 全部改成一条语句的形式,如下: </bean> <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"> <property name="driverClassName" value="net.sourceforge.jtds.jdbc.Driver"/> <property name="url" value="jdbc:jtds:sqlserver://localhost:1433/FundTransaction"/> <property name="username" value="sa"/> </bean> |
||
---|---|---|---|
级别: 白丁
|
6# 发表于:2010-11-15 14:28:16 IP:60.233.*.*
这是原来的配置文件
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jee="http://www.springframework.org/schema/jee" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd" default-lazy-init="true"> <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="locations"> <list> <value>/WEB-INF/config/jdbc.properties</value> </list> </property> </bean> <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"> <property name="driverClass" value="${jdbc.driverClassName}" /> <property name="jdbcUrl" value="${jdbc.url}" /> <property name="user" value="${jdbc.username}" /> <property name="password" value="${jdbc.password}" /> <property name="autoCommitOnClose" value="true"/> <property name="checkoutTimeout" value="${cpool.checkoutTimeout}"/> <property name="initialPoolSize" value="${cpool.minPoolSize}"/> <property name="minPoolSize" value="${cpool.minPoolSize}"/> <property name="maxPoolSize" value="${cpool.maxPoolSize}"/> <property name="maxIdleTime" value="${cpool.maxIdleTime}"/> <property name="acquireIncrement" value="${cpool.acquireIncrement}"/> <property name="maxIdleTimeExcessConnections" value="${cpool.maxIdleTimeExcessConnections}"/> </bean> <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="dataSource" ref="dataSource"/> <property name="mappingLocations"> <list> <value>classpath*:/com/jeecms/core/entity/hbm/*.hbm.xml</value> <value>classpath*:/com/jeecms/cms/entity/hbm/*.hbm.xml</value> </list> </property> <property name="hibernateProperties"> <value> hibernate.dialect=org.hibernate.dialect.SQLServerDialect hibernate.show_sql=false hibernate.format_sql=false hibernate.query.substitutions=true 1, false 0 hibernate.jdbc.batch_size=20 hibernate.cache.use_query_cache=true </value> </property> <property name="entityInterceptor"> <ref local="treeInterceptor"/> </property> <property name="cacheProvider"> <ref local="cacheProvider"/> </property> <property name="lobHandler"> <ref bean="lobHandler" /> </property> </bean> <bean id="lobHandler" class="org.springframework.jdbc.support.lob.DefaultLobHandler" lazy-init="true"/> <bean id="cacheProvider" class="com.jeecms.common.hibernate3.SpringEhCacheProvider"> <property name="configLocation"> <value>classpath:ehcache-hibernate.xml</value> </property> <property name="diskStoreLocation"> <value>/WEB-INF/cache/hibernate</value> </property> </bean> <bean id="treeInterceptor" class="com.jeecms.common.hibernate3.TreeIntercptor"/> <!-- 事务配置 --> <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"> <property name="sessionFactory" ref="sessionFactory" /> </bean> <context:annotation-config/> <!-- 使用annotation定义事务 --> <tx:annotation-driven transaction-manager="transactionManager" /> </beans> |
||
---|---|---|---|