我在尝试在Java项目中配置Hibernate时遇到了一些问题。我正在寻找论坛,但我找不到任何解决方案。我是Hibernate的新手,你能帮我吗?提前谢谢。
这是我的hibernate.cfg.xml文件内容:
<?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 name="ConexionHibernate">
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.password">hr</property>
<property name="hibernate.connection.url">jdbc:mysql://localhost:1521/xe</property>
<property name="hibernate.connection.username">hr</property>
<property name="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</property>
</session-factory>
</hibernate-configuration>
This is how my DataBase Connection looks like in Oracle SQL Developer
答案 0 :(得分:1)
在你的配置中,jdbc驱动程序是为mysql设置的,连接url也不正确,对于oracle来说:
<property name="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
<property name="hibernate.connection.url">jdbc:oracle:thin:@localhost:1521:xe</property>