【问题标题】:driver connection problems using hibernate with oracle使用带有 oracle 的休眠模式的驱动程序连接问题
【发布时间】:2015-04-24 20:13:08
【问题描述】:

我是使用休眠的新手,所以当我尝试连接到 Oracle 数据库时遇到问题。我正在一步一步地遵循this 教程,但是在Creating the Hibernate Reverse Engineering File 中的here 在oracle 驱动程序尝试建立连接时出现了一些错误。这是确切的错误:

这是我的 hibernate.cfg.xml:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
  <session-factory>
    <property name="hibernate.dialect">org.hibernate.dialect.OracleDialect</property>
    <property name="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
    <property name="hibernate.connection.url">jdbc:oracle:thin:@localhost:1521:orcl</property>
    <property name="hibernate.connection.username">hotel</property>
    <property name="hibernate.connection.password">hotel</property>
    <property name="hibernate.show_sql">true</property>
    <property name="hibernate.current_session_context_class">thread</property>
    <property name="hibernate.query.factory_class">org.hibernate.hql.classic.ClassicQueryTranslatorFactory</property>
  </session-factory>
</hibernate-configuration>

也许我需要在某个地方设置 jdbc oracle 驱动程序,但我不知道确切的位置。知道可能出了什么问题吗?

提前致谢!!

【问题讨论】:

    标签: java spring oracle hibernate netbeans


    【解决方案1】:

    Oracle 驱动程序不在您的类路径中。您需要访问 Oracle 站点并下载 Oracle 瘦驱动程序。这是 11g 的页面:

    http://www.oracle.com/technetwork/apps-tech/jdbc-112010-090769.html

    以下是与 oracle 对话的 netbeans 说明:

    https://netbeans.org/kb/docs/ide/oracle-db.html#oci

    您必须先安装 Oracle Database Instant Client,然后确保 ojdbc6.jar 文件位于您的类路径中。

    【讨论】:

      猜你喜欢
      • 2016-11-19
      • 1970-01-01
      • 1970-01-01
      • 2016-06-16
      • 2023-03-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-11-20
      相关资源
      最近更新 更多