JDBC CONNECTION???????????????????????????????????????????///

suniums 2003-04-04 09:55:19
我的程序段:
Class.forName ("org.postgresql.Driver");
mSQLcon = DriverManager.getConnection( "jdbc:postgresql:net//172.16.131.231:5432/billing" , "billing" , "" );
平台是SUN solaris8(SPARC)
返回的错误是:

Connection refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP c
onnections.
at org.postgresql.jdbc1.AbstractJdbc1Connection.openConnection(AbstractJdbc1Connection.java:167)
at org.postgresql.Driver.connect(Driver.java:122)
at java.sql.DriverManager.getConnection(DriverManager.java:512)
at java.sql.DriverManager.getConnection(DriverManager.java:172)
at com.nec.jp.inetworx.bs.pri.filemanage.PriDatabase.getConnection(PriDatabase.java:90)
at com.nec.jp.inetworx.bs.pri.filemanage.PriFileMain.mainControl(PriFileMain.java:128)
at com.nec.jp.inetworx.bs.pri.filemanage.dummy.main(dummy.java:24)
...全文
22 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
suniums 2003-04-09
  • 打赏
  • 举报
回复
启动参数中加-i也可以。
joint 2003-04-04
  • 打赏
  • 举报
回复
jdbc.postgresql.org
townsin 2003-04-04
  • 打赏
  • 举报
回复
suniums (星空):
请问
在哪里下载编译好的驱动 ?
joint 2003-04-04
  • 打赏
  • 举报
回复
Because Java only uses TCP/IP connections, the PostgreSQL server must be configured to accept TCP/IP connections. This can be done by setting tcpip_socket = true in the postgresql.conf file or by supplying the -i option flag when starting postmaster.
joint 2003-04-04
  • 打赏
  • 举报
回复
编辑postgresql.conf,把tcpip改成true
环境: Eclipse Java EE IDE for Web Developers. Version: Oxygen.3a Release (4.7.3a) mysql-connector-java-8.0.11 MySQL Server 8.0 Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary. 驱动的类换了个名字 Class.forName("com.mysql.cj.jdbc.Driver"); Fri Jun 08 13:09:27 CST 2018 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification. 加上useSSL=true或false 参考地址 con = DriverManager.getConnection("jdbc:mysql://127.0.0.1:3306/test?useSSL=true", "root", "123456"); java.sql.SQLException: The server time zone value '???ú±ê×??±??' is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the serverTimezone configuration property) to use a more specifc time zone value if you want to utilize time zone support. 加上serverTimezone=GMT 参考地址 con = DriverManager.getConnection("jdbc:mysql://127.0.0.1:3306/test?useSSL=true&serverTimezone=GMT", "root", "123456")

56,679

社区成员

发帖
与我相关
我的任务
社区描述
MySQL相关内容讨论专区
社区管理员
  • MySQL
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧