org.hibernate.exception.GenericJDBCException: Cannot open connection 错误!
我昨天运行好好的程序,今天莫名其妙就出问题了,请求帮助,看看哪的问题
org.hibernate.exception.GenericJDBCException: Cannot open connection
org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:91)
org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:79)
org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:29)
org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:307)
org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:109)
org.hibernate.jdbc.JDBCContext.connection(JDBCContext.java:134)
org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:57)
org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1236)
test.hibernate.factory.CustomerFactory.getAll(CustomerFactory.java:38)
test.hibernate.servlet.CustomerControl.doPost(CustomerControl.java:28)
test.hibernate.servlet.CustomerControl.doGet(CustomerControl.java:77)
javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
test.util.RequestEncodingFilter.doFilter(RequestEncodingFilter.java:35)
这是我的映射文件
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<!--数据库URL-->
<property name="hibernate.connection.url">
jdbc:JSQLConnect://localhost:1433/MoneyManage
</property>
<!--数据库驱动-->
<property name="hibernate.connection.driver_class">
com.jnetdirect.jsql.JSQLDriver
</property>
<!--数据库用户名-->
<property name="hibernate.connection.username">
sa
</property>
<!--数据库密码-->
<property name="hibernate.connection.password">
123
</property>
<!--对应Dialect-->
<property name="dialect">
org.hibernate.dialect.SQLServerDialect
</property>
<property name="show_sql">
true
</property>
<!--是否使用外连接-->
<property name="hibernate.use_outer_join">
true
</property>
<!--事物管理类型-->
<property name="hibernate.transaction.factory_class">
org.hibernate.transaction.JDBCTransactionFactory
</property>
<!--数据库连接池-->
<property name="hibernate.c3p0.max_size">5</property>
<property name="hibernate.c3p0.min_size">2</property>
<property name="hibernate.c3p0.timeout">15000</property>
<property name="hibernate.c3p0.max_statements">1000</property>
<property name="hibernate.c3p0.idle_test_period">3000</property>
<property name="hibernate.c3p0.acquire_increment">5</property>
<property name="hibernate.c3p0.validate">false</property>
<property name="hibernate.connection.provider_class">
org.hibernate.connection.C3P0ConnectionProvider
</property>
<!--映射文件-->
<mapping resource="org/mytest/hibernate/CostInfo.hbm.xml"/>
<mapping resource="org/mytest/hibernate/CostType.hbm.xml"/>
<mapping resource="org/mytest/hibernate/Income.hbm.xml"/>
<mapping resource="org/mytest/hibernate/Customer.hbm.xml"/>
</session-factory>
</hibernate-configuration>
这是我server.xml里的一段配置
<Context path="/Manager" docBase="Manager" debug="0" crosscontext="true" reloadable="true"> </Context>
我的hibernate通用文件
package test.hibernate;
import org.hibernate.*;
import org.hibernate.cfg.*;
public class HibernateUtil {
public static final SessionFactory sessionFactory;
static{
try{
Configuration config = new Configuration().configure();
sessionFactory = config.buildSessionFactory();
}
catch (Throwable ex){
System.err.println("Initial SessionFactory creation failed." + ex);
throw new ExceptionInInitializerError(ex);
}
}
public static SessionFactory getSessionFactory() {
return sessionFactory;
}
}
现在为什么不能打开连接,
请大家帮忙 告诉我配置哪里有问题。