Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2017
    Posts
    1

    Unanswered: JDBC connection paramater to allow stopping

    Hi,

    First time poster. I have a question about DB2 JDBC.

    I have a small (custom) Java based monitoring tool to manage my DB2 server. It does many health checking things disk and memory usage. For some of the checks, SQL commands are executed via JDBC.

    The problem now is that the DB this monitoring tool has to be stopped each time you want to stop DB2.

    My question: Are there any connection properties or something that tell's DB2 that it is fine to ignore this specific connection? I really don't want to change any config on DB2's side or stop the tool each time I stop DB2.

    Any recommendations would be great!

  2. #2
    Join Date
    Jul 2016
    Location
    Moscow
    Posts
    294
    Provided Answers: 45
    Hi,

    On the server:
    db2 update alternate server for db dbname using hostname server_host_name port portnumber
    dbname - your database name
    server_host_name - the db2 server's host name which resolves to the same IP address on the server and the client
    portnumber - the same port number which your server listens

    Add the following to the JDBC URL of your application:
    ;clientRerouteAlternateServerName=server_host_name;clientRerouteAlternatePortNumber=portnumber;retryIntervalForClientReroute=10;maxRetriesForCli entReroute=9999;enableSeamlessFailover=1;

    Reconnect your application.
    It should try to reconnect to the server for 10 x 9999 seconds automatically until your server becomes available.
    Depending on what your application was doing when db2 was stopped, you can get ErrorCode=-4498 if there was impossible to reconnect cleanly, but the database connection will be reestablished automatically. If you are lucky, you even won't get any error.
    Regards,
    Mark.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •