Use the PROTOCOL_CAPTURE connection property to specify a file for receiving the TDS packets exchanged between an application and an SAP Adaptive Server.
PROTOCOL_CAPTURE takes effect immediately so that TDS packets exchanged during connection establishment are written to the specified file. All packets continue to be written to the file until Capture.pause is executed or the session is closed.
... props.put("PROTOCOL_CAPTURE", "tds_data") Connection conn = DriverManager.getConnection(url, props);
where url is the connection URL, and props is a Properties object for specifying connection properties.