问题描述:
初学hibernate 映射oralc10g数据库出现 The Network Adapter could not establish the connection oralce 错误。
hibernate 配置文件如下:
<?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>
<!-- Database connection settings -->
<property name="connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
<property name="connection.url">jdbc:oracle:thin:@localhost:1521/oracle</property>
<property name="connection.username">xxg</property>
<property name="connection.password">xxg</property>
<!-- JDBC connection pool (use the built-in) -->
<!-- <property name="connection.pool_size">1</property> -->
<!-- SQL dialect -->
<property name="dialect">org.hibernate.dialect.Oracle10gDialect</property>
<!-- Enable Hibernate's automatic session context management -->
<!-- <property name="current_session_context_class">thread</property> -->
<!-- Disable the second-level cache -->
<property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>
<!-- Echo all executed SQL to stdout -->
<property name="show_sql">true</property>
<!-- Drop and re-create the database schema on startup -->
<!-- <property name="hbm2ddl.auto">update</property> -->
<mapping resource="com/xxg/bean/Student.hbm.xml"/>
</session-factory>
</hibernate-configuration>
解决办法:
lz这样:开始--> 运行--> cmd--> netstat -na
找找里面有没有如下一行:
TCP 127.0.0.1:1521 0.0.0.0:0 LISTENING
出现错误时,我没找到。当把localhost 改成127.0.0.1时候解决问题了。
之后在改成localhost 时发现 错误也没出现。
在这个过程之中添加了 Net Manager 的监听地址,主机名为:172.0.0.1, 端口号为:1521
分享到:
相关推荐
hibernate连接oracle数据库.doc
hibernate连接oracle数据库.pdf
java项目中hibernat框架下常用jar包
hibernate连接数据库的连接配置。包括oracle等一系列配置。
使用hibernate连接oracle数据库的详细方法,代码实现实现数据库的增删改查.zip
使用hibernate连接oracle数据库的详细方法,代码实现实现数据库的增删改查.rar
是我自己做的springMVC+hibernate的环境,包括连接数据库查询,基于注解的方式
hibernate连接Oracle和mySql数据库驱动下载,mysql-connector-java-5.1.7-bin.jar,ojdbc6.jar,ojdbc7.jar,xdb6.jar,ucp.jar,simplefan.jar,orai18n.jar,ons.jar,antlr-2.7.7.jar,c3p0-0.9.2.1.jar等等全部...
博文链接:https://wxinpeng.iteye.com/blog/203110
主要介绍了详解Spring Hibernate连接oracle数据库的配置的相关资料,需要的朋友可以参考下
oracle连接hibernate必用驱动
首先,Hibernate提供了一些基本的数据库连接驱动程序,例如mysql、oracle、sqlserver等。这些驱动程序可以让Hibernate连接不同的数据库。但是,为了确保数据的正确性和一致性,Hibernate还需要使用不同的SQL方言来...
hibernate连接mysql,oracle,sqlserver, access数据库包和方法
用eclicpse实现的hibernate连接oracle数据库,并提取中文的小程序
hibernate基本的jar包 本人初学花了不少功夫,希望可以帮助大家:所用数据库是oracle
Oracle数据库是关系型数据库,需要使用JDBC来连接数据库。可以使用Hibernate来映射Java对象到数据库表中。 知识点八:JSP技术的使用 JSP技术是实现XML文件到Oracle数据库的导入和导出的关键步骤。可以使用JSP来...
带oracle数据库和ssh的例子,和具体的配置
SQL-SERVER-64位配置ORACLE连接-中文乱码问题