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

org.hibernate.exception.GenericJDBCException: Cannot open connection

2014-01-26 
我是用hirbernate连接oracle数据库,出现如下异常 log4j:WARN No appenders could be found for logger (org

我是用hirbernate连接oracle数据库,出现如下异常


log4j:WARN No appenders could be found for logger (org.springframework.context.support.ClassPathXmlApplicationContext).
log4j:WARN Please initialize the log4j system properly.
Exception in thread "main" org.hibernate.exception.GenericJDBCException: Cannot open connection
at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103)
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:29)
at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:420)
at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:144)
at org.hibernate.jdbc.BorrowedConnectionProxy.invoke(BorrowedConnectionProxy.java:40)
at $Proxy1.toString(Unknown Source)
at java.lang.String.valueOf(String.java:2827)
at java.io.PrintStream.println(PrintStream.java:771)
at com.rj.service.DBConnection.main(DBConnection.java:23)
Caused by: java.sql.SQLException: Io 异常: The Network Adapter could not establish the connection
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:333)
at oracle.jdbc.driver.OracleConnection. <init>(OracleConnection.java:404)
at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.java:468)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:314)
at java.sql.DriverManager.getConnection(DriverManager.java:582)
at java.sql.DriverManager.getConnection(DriverManager.java:154)
at org.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:110)
at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:417)
... 6 more


------解决方法--------------------------------------------------------
Exception in thread "main" org.hibernate.exception.GenericJDBCException: Cannot open connection
数据库连接错误,不知道你是怎么连接数据库的,可能有以下几个问题:
1、连接的用户名或密码不对
2、连接的端口不对
3、缺少数据库的连接包
4、分布式数据库可能存在通信问题,可以ping一下看通不通
------解决方法--------------------------------------------------------
在\Oracle\Ora92\Apache\Apache\conf\httpd.conf查找"Port"就行了,Port后跟的数字即为端口号
------解决方法--------------------------------------------------------
看不出什么问题!!不能打开连接,看看你的oracle服起来了没有!!看看用你客户端能不能连接上!

        

热点排行