问题描述
- oracle11g连接Hibernate遇到问题了。连着连着就断开了。求大神解答
-
2015-9-5 0:04:42 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure INFO: HHH000006: Autocommit mode: false 2015-9-5 0:04:42 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure INFO: HHH000401: using driver [oracle.jdbc.driver.OracleDriver] at URL [jdbc:oracle:thin:@localhost:1521:ORCL] 2015-9-5 0:04:42 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure INFO: HHH000046: Connection properties: {useUnicode=true, user=hr, password=****, characterEncoding=UTF-8, pool.size=1} 2015-9-5 0:04:43 org.hibernate.dialect.Dialect <init> INFO: HHH000400: Using dialect: org.hibernate.dialect.OracleDialect 2015-9-5 0:04:43 or
g.hibernate.dialect.Oracle9Dialect <init> WARN: HHH000063: The Oracle9Dialect dialect has been deprecated; use either Oracle9iDialect or Oracle10gDialect instead 2015-9-5 0:04:43 org.hibernate.dialect.OracleDialect <init> WARN: HHH000064: The OracleDialect dialect has been deprecated; use Oracle8iDialect instead 2015-9-5 0:04:43 org.hibernate.engine.jdbc.internal.LobCreatorBuilder useContextualLobCreation INFO: HHH000424: Disabling contextual LOB creation as createClob() method threw error : java.lang.reflect.InvocationTargetException 2015-9-5 0:04:43 org.hibernate.engine.transaction.internal.TransactionFactoryInitiator initiateService INFO: HHH000399: Using default transaction strategy (direct JDBC transactions) 2015-9-5 0:04:44 org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory <init> INFO: HHH000397: Using ASTQueryTranslatorFactory
以上是错误信息,下面是我的配置
<?xml version="1.0" encoding="utf-8" ?> <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd"> <hibernate-configuration> <session-factory> <property name="connection.driver_class">oracle.jdbc.driver.OracleDriver</property> <property name="connection.url">jdbc:oracle:thin:@localhost:1521:orcl</property> <property name="connection.username">hr</property> <property name="connection.password">08</property> <property name="dialect">org.hibernate.dialect.OracleDialect</property> <property name="show_sql">true</property> <property name="hibernate.connection.pool.size">1</property> <property name="hibernate.statement_cache.size">25</property> <property name="hibernate.jdbc.fetch_size">50</property> <property name="hibernate.jdbc.batch_size">30</property> <property name="connection.useUnicode">true</property> <property name="connection.characterEncoding">UTF-8</property> <mapping resource="com/wx/beans/User.hbm.xml"/> </session-factory> </hibernate-configuration>
求高人解答。。
解决方案
第一次在这儿问自己觉得有些水平的问题,已经难倒我一下午了。。从5点到0点半了。。不会解决。求解答。用的数据库JAR包:ojdbc14_11g.jar 和
ojdbc6.jar,不确定到底用哪个,就都用了。
解决方案二:
是不是跟你property的顺序有关,不然就是你oracle的方言用错了
解决方案三:
我用的是这个,你试试看,我也是11g
Oracle
#hibernate.dialect org.hibernate.dialect.Oracle10gDialect
#hibernate.connection.driver_class oracle.jdbc.driver.OracleDriver
#hibernate.connection.username ora
#hibernate.connection.password ora
#hibernate.connection.url jdbc:oracle:thin:@localhost:1521:orcl
时间: 2024-10-03 08:49:23