nested exception is org.hibernate.exception.GenericJDBCException: Cannot open connection

nested exception is org.hibernate.exception.GenericJDBCException: 

Cannot open connection


网页上大致错误信息:
nested exception is org.hibernate.exception.GenericJDBCException: Cannot open connection
nested exception is org.hibernate.exception.GenericJDBCException: Cannot open connection
nested exception is org.hibernate.exception.GenericJDBCException: Cannot open connection

nested exception is org.hibernate.exception.GenericJDBCException: Cannot open connection

首先说明一下,在本地上是可以的:
nested exception is org.hibernate.exception.GenericJDBCException: Cannot open connection

但是在将这个WAR包放到公司服务器上就不行了,老是报这个错误:
java.net.UnknownHostException: www.hongshanwang.com

这是为什么呢?
很明显是数据库连接语言出错,因为在本地可以,在外网就不行了,这里要说一下,局域网访问数据库和外网访问还是有很多区别的。

出错的时,数据库连接语言如下:
jdbc.url= jdbc:mysql://www.hongshanwang.com:3306/tdjdb?zeroDateTimeBehavior=convertToNull&characterEncoding=UTF-8&characterSetResults=UTF-8
jdbc.username=tdj*****
jdbc.password=xwh********

解决这个问题是方法是:
jdbc.url= jdbc:mysql://220.231.193.7:3306/tdjdb?zeroDateTimeBehavior=convertToNull&characterEncoding=UTF-8&characterSetResults=UTF-8
jdbc.username=tdj*****
jdbc.password=xwh********

其实,也就是把域名www.hongshanwang.com,ping成IP地址,220.231.193.7,而已。这样这个问题就解决了。KOS。
nested exception is org.hibernate.exception.GenericJDBCException: Cannot open connection
nested exception is org.hibernate.exception.GenericJDBCException: Cannot open connection




nested exception is org.hibernate.exception.GenericJDBCException: Cannot open connection,布布扣,bubuko.com

nested exception is org.hibernate.exception.GenericJDBCException: Cannot open connection

上一篇:对SQL语句进行过滤的函数


下一篇:Pandas入门之十六:级联