Extremely slow DB2 connectivity in Java

筅森魡賤 提交于 2019-12-06 07:24:31

First off I would try to up the log level on the driver to debug or even trace. This might give you an easy way of seeing where it is hanging in it's attempt to complete the connection. Are you using log4j?

Check if your DNS configuration is 100% correct.

Establish tracing on the client and on the server side. This should allow you to differentiate between the following possible issues:

  • the driver implementation being slow (receives answer, but takes a long time to reply)
  • the network being slow (turnaround on both ends is fast, but with large breaks in between)
  • the database being slow to react (same as the first but on the server end)
  • there is just a lot of stuff going back and forth

Once you have found the issue you'll have to dig deeper in order to understand why this is the case.

This is happening because the driver does a reverse lookup of the IP to resolve a host name, an easy fix is to add the server and hostname to your System32\drivers\etc\hosts (if you're on windows) file, then use the hostname you just mapped. E.g.

%WINDOWS%System32\drivers\etc\hosts

128.0.0.200 DB_SERVER

then in your application:

jdbc:db2://DB_SERVER:55701/SCHEMA_NAME

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!