ERRORCODE = -4499, SQLSTATE = 08001 "connecting to remote DB2

I am trying to connect to a remote DB2 using the IBM Type 4 JDBC driver. Here is my configuration:

Server:

  • Windows 7 Professional Professional
  • DB2 LUW V10.5
  • DB2 SVCENAME = 50000
  • TCP / IP for communication

Customer:

  • OS / x V10.10.3
  • Eclipse mars
  • IBM DB2 Java Type 4 Drivers

As far as I understand, if you are writing a client application in Java and using pure Java Type 4 drivers, the client does not need to install the client. The application will use DRDA to connect directly to the remote database.

Here is the piece of code I was trying to get for remote db2:

public class BlobRetrieval {

    static String databaseDriver;
    static String dbURL;
    static String userName;
    static String password;
    static Connection passConn; 

public static void main(String[] args) {        
    databaseDriver = "com.ibm.db2.jcc.DB2Driver";
    dbURL = "jdbc:db2://192.168.1.81:50000/LOBDB";
    userName = "ace";
    password = "ace";
    try {
        Class.forName(databaseDriver).newInstance();
        System.out.println("register successful");
        Connection connection = DriverManager.getConnection(dbURL, userName, password);
        System.out.println("connection successful");
        passConn = connection;
        PreparedStatement preparedStatement=connection.prepareStatement("SELECT BOOKCOVER FROM BOOKCOVERS WHERE BOOKISBN=?");
        preparedStatement.setString(1, "0738425826");
    }
}

      

When I follow these instructions, I get the following error:

register successfully com.ibm.db2.jcc.am.DisconnectNonTransientConnectionException: [jcc] [t4] [2043] [11550] [4.19.26] Exception java.net.ConnectException: Error opening socket on server /192.168.1.81 on port 50 000 with the message: Runtime disabled. ERRORCODE = -4499, SQLSTATE = 08001 at com.ibm.db2.jcc.am.kd.a (Unknown source) at com.ibm.db2.jcc.am.kd.a (Unknown source) at com.ibm.db2 .jcc.t4.ac.a (Unknown source) at com.ibm.db2.jcc.t4.ac. (Unknown source) at com.ibm.db2.jcc.t4.ab (Unknown source) at com.ibm.db2.jcc.t4.b.newAgent_ (Unknown source) at com.ibm.db2.jcc.am.Connection .initConnection (Unknown Source) at com.ibm.db2.jcc.am.Connection. (Unknown source) at com.ibm.db2.jcc.t4.b. (Unknown source) at com.ibm.db2.jcc.DB2SimpleDataSource.getConnection (Unknown Source) at com.ibm.db2.jcc.DB2SimpleDataSource.getConnection (Unknown Source) at com.ibm.db2.jcc.DB2Driver.connect (Unknown Source) at com.ibm.db2.jverc.DB2 connect (Unknown source) at java.sql.DriverManager.getConnection (DriverManager.java:664) at java.sql.DriverManager.getConnection (DriverManager.java:247) at dbAccessPackage.BlobRetrieval.main (BlobRetrieval.java:30) Called java.net.ConnectException: Work timed out on java.net.PlainSocketImpl.socketConnect (native method) on java.net.AbstractPlainSocketImpl.doConnect (AbstractPlainSocketImpl.java:345) on java.net.AbstractPlainSocketImo: AbstractPlainPlainSocketImopl.connectToava ) to java.net.AbstractPlainSocketImpl.connect (AbstractPlainSocketImpl.java:188) at java.net.SocksSocketImpl.connect (SocksSocketImpl.java:392) at java.net.Socket.connect (Socket.java:589) at com.ibm.db2.jcc.t4.w.run (Unknown source) at java.security.AccessController.doPrivileged (native method)

+3


source to share


2 answers


In many cases, the local firewall on the server is a problem. Windows Firewall may be blocking the incoming request.



Could you please check that the port is open (any blocking reported by the firewall)? Is there any activity in the db2diag.log file (diagnostic log file) of the DB2 server? As a quick test, you can telnet 192.168.1.81 50000 from your client computer. If it succeeds and you get a connection, the firewall is not a problem (anymore).

+1


source


I had the same problem. and spend about 4 hours, then the solution below worked for me:

Project Explorer -> Server -> Tomcat v XX -> open server.xml

<Connector port="8484" protocol="AJP/1.3" redirectPort="8484 "/>

      



I change the port and redirectPort with the same port number that I assign to the ie8080 or 8484 server.

Hope it works.

0


source







All Articles