Hello,
Coming a bit late on this topic, but never too late to discuss for the future use.
I created DB Check custom service that might be faster than the script run by CLA or Java Task that will be compiled every time when executed:
Here are few lines of code, although JDBCService seems as depricated and not sure what is a new class we can use:
import com.sterlingcommerce.woodstock.util.frame.jdbc.JDBCService;
import java.sql.Connection;
public class DBCheck {
public boolean dbcheck(WorkFlowContext wfc, String pool, boolean logging) throws Exception {
if (pool == null || pool.length() == 0) {
doLogging(true, wfc, "pool is required for DBCheck mode!");
} else {
try{
//Connection con = JDBCService.getConnectionWithoutTestOnReserve(pool);
Connection con = JDBCService.getConnection(pool,true);
wfc.setWFContent("Response/connection", "true");
//con.close();
JDBCService.freeConnection(pool, con);
Kind regards,
Mirjana
------------------------------
Mirjana Vojvodic
------------------------------
Original Message:
Sent: Fri April 26, 2024 03:48 PM
From: John Morrissey
Subject: How to check JDBC connection before using.
Hi Navyakanth.
Thank you for the suggestions. After reading through the JDBC setup more closely, I think we can make a couple of changes to the configuration that should help us.
------------------------------
John Morrissey
------------------------------
Original Message:
Sent: Thu April 25, 2024 05:11 PM
From: navyakanth surugu
Subject: How to check JDBC connection before using.
If my understanding is correct, you need a way to check connectivity to the SQL server before running the translation map to avoid the process hanging indefinitely. Here are a few approaches you can consider:
• You can use a simple ping test to check if the SQL server is reachable before attempting to run the translation map. If the ping fails, you can issue an error and stop the process.
• Configure a connection timeout for the JDBC adapter in your business process. This will ensure that if the connection cannot be established within a specified time frame, it will fail gracefully rather than hanging indefinitely.
• Implement a heartbeat monitoring mechanism between the B2B server and the SQL server. This could involve periodically sending a lightweight query or request to the SQL server to check connectivity. If the heartbeat fails, you can trigger an alert or stop the process.
• Develop a custom script or tool that performs a health check on the SQL server, verifying its availability and responsiveness. Integrate this check into your business process to ensure connectivity before proceeding with the translation map
• If you're not already using connection pooling, consider implementing it. Connection pooling can help manage connections more efficiently and potentially detect and handle connectivity issues more effectively.
• Implement retry logic in your business process to handle temporary connectivity issues. This could involve retrying the connection after a certain interval or implementing exponential backoff to avoid overwhelming the system with retry attempts.
By configuring one or more of these approaches into your business process, you can manage and handle connectivity issues with the SQL server and reduce the risk of hanging processes and improving overall reliability.
------------------------------
navyakanth surugu