首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Java Exception >

org.hibernate.exception.GenericJDBCException: Cannot open connection 异常!

2014-01-26 
org.hibernate.exception.GenericJDBCException: Cannot open connectionorg.hibernate.exception.SQLState

  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"/>         

热点排行