【发布时间】:2016-05-10 12:15:07
【问题描述】:
我正在使用 Postgresql 数据库。我需要知道如何在 hibernate.cfg.xml 中为远程连接提供连接 url。我在下面给出了行。但我无法从数据库中检索数据。
<property name="hibernate.connection.driver_class">org.postgresql.Driver</property>
<property name="hibernate.connection.url">jdbc:postgresql://hostIP:5432/databasename</property>
<property name="hibernate.connection.username">postgres</property>
<property name="hibernate.connection.password">password</property>
【问题讨论】:
-
把主机的IP放在DB所在的地方
-
是的,我只给了 HostIP...仍然抛出 org.postgresql.util.psqlexception 连接被拒绝
-
请检查主机名和端口是否正确
-
尝试从您的机器连接,然后检查代码
-
有效吗?或使用我的 xml
标签: java database hibernate postgresql