Reconnct to database isn't happening after Mule starts - database

I am trying the Reconnection configuration in Mule for database connection. My goal is to make Mule retry the connection if the database is down, or at least keep the message somewhere so that I can post the message again later.
So I configure the Reconnection in the jdbc connector as followed:
<jdbc-ee:connector name="MyDatabase" dataSource-ref="DB2_Data_Source" validateConnections="true" queryTimeout="-1" pollingFrequency="0" doc:name="Database">
<reconnect frequency="6000" count="8"/>
</jdbc-ee:connector>
It works if I start Mule when database is down. I can see in the log that Mule is retrying the reconnect.
The problem comes when the database is down after Mule has already started. I tried by shutting down my database after I ran the flow. I don't see Mule trying to reconnect to the database. When I post a message that hits the database endpoint, it just throws a SQLException and doesn't try to reconnect. Thus my message is lost.
Is there a way to make Mule retry the connection if database is down after Mule starts and log the error somewhere if the retry fails?

Related

Failure writing file Log_File_Risk_Alert_Report : The permissions granted to user '' are insufficient for performing this operation

Context: I keep raising this error when I try to execute an SSRS Email or File Drop subscription - and I have no idea why. The empty string '' seems to imply I need to add some specific user information but I have no idea where.
I was able to send a test email through the Database Mail wizard in the management studio. I noticed in the SQL Server sysmail_event_log record for that event the last_mod_user was NTService\MSSQLSERVER. But the failed subscription execution attempts are showing up under the sa in the last_mod_user I suspect something is at play between this discrepancy but idk how to fix it.
The error description also reads:
The mail could not be sent to the recipients because of the mail
server failure. (Sending Mail using Account 4 (2022-04-22T17:41:01).
Exception Message: Cannot send mails to mail server. (The SMTP server
requires a secure connection or the client was not authenticated. The
server response was: 5.7.57 Client not authenticated to send mail.
[BN0P110CA0026.NAMP110.PROD.OUTLOOK.COM]). )
Questions: Can someone please assist?
Add the account to the Local Admin of the Machine to fix the Operation.Mail one

Time lag while connecting from Talend-SalesForce using tSalesForceConnection component

I am trying to connect to SalesForce using SalesForce connector in Talend. Now when I send the connection request, I can see that the connection is established after ~2 seconds and as soon as the connection is established to SalesForce url, the response is in milliseconds. I am using tSalesForceConnection to establish the connection to SalesForce from Talend but there is a time lag in that process.
I am using oAuth authentication type to authenticate with SalesForce server
An example using tsttatcacter logs we see between begin and end it is taking 2 seconds.
2020-10-22 13:52:38|CgqWpf|CgqWpf|CgqWpf|16220|sample|samplelog|_PF7PIBPKEeuGlI4APhARAg|0.1|Default||begin||
2020-10-22 13:52:38|CgqWpf|CgqWpf|CgqWpf|16220|sample|samplelog|_PF7PIBPKEeuGlI4APhARAg|0.1|Default|tSalesforceConnection_2|begin||
2020-10-22 13:52:39|CgqWpf|CgqWpf|CgqWpf|16220|sample|samplelog|_PF7PIBPKEeuGlI4APhARAg|0.1|Default|tSalesforceConnection_2|end|success|1478
1515 milliseconds
2020-10-22 13:52:39|CgqWpf|CgqWpf|CgqWpf|16220|sample|samplelog|_PF7PIBPKEeuGlI4APhARAg|0.1|Default||end|success|1515
Does anyone have any idea why is there a time lag in establishing connection via Talend and if there are ways to improve it?

Connection timeout with SlashDB and Azure SQL DB

I've just installed SlashDB and connected to an Azure SQL DB successfully. Querying works and everything is fine. However, after a while, if I retry my previously working query, I get an error from SlashDB:
500 Internal Server Error (pyodbc.OperationalError) ('08S01', u'[08S01] [FreeTDS][SQL Server]Write to the server failed (20006) (SQLExecDirectW)')
I'm not writing anything to the server, if that matters. But if I retry the query immediately, it works. My deep analysis (=guess) of this all is that the SQL Server terminates the idle connection. Now, I'd like SlashDB to retry when it fails, instead of returning error to the the client. Is this possible?
Apparently Azure SQL DB could be breaking connections due to either their redundancy limitations or the 30 minute idle.
https://azure.microsoft.com/en-us/blog/connections-and-sql-azure/
For performance reasons SlashDB does not establish a new connection for every request, but instead maintains a pool of connections.
MySQL, has a similar behavior, which is widely known (60 minutes idle timeout) and SlashDB actually has a logic to attempt reconnect. It should implement the same for all database types, but I need to confirm that with the development team (and fix if not the case).
In the meantime, you could either retry on the client side or send a periodic request for to avoid the timeout.

BizTalk HL7 Receive Pipeline Unable to configure logstore -- SQL server error

I've recently installed the BizTalk 2013 HL7 adapter on my development machine. During setup, it asks for the logging account, which I provided and was successfully added and the installation finished without a hitch.
However, when I try to submit a message to the Receive port configured to use the HL7 pipeline, I'm always receiving the same errors
First there is an "Information" event log stating:
Login failed for user 'my-BizTalk-HOST-account'. Reason: Failed to open
the explicitly specified database. [CLIENT: 1.2.3.4]
Then immediately after there is:
There was a failure executing the receive pipeline: "BTAHL72XPipelines.BTAHL72XReceivePipeline, BTAHL72XPipelines, Version=1.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Source: "BTAHL7 2.X Disassembler" Receive Port: "my-receive-port-name" URI: "0.0.0.0:11001" Reason: Unable to configure the logstore.
If I look at the details tab in the event, it shows in the Binary Data in Bytes, the name of my server, followed by master.
A few points to consider:
we do not have SQL Server logging enabled in the HL7 configuration
tool (just the event log)
my-BizTalk-HOST-account is not the account that is configured for HL7 logging anyway, so why is it being used?
I'm not sure why it's trying to access the master database (if that is indeed what the event log is telling me)
SQL logins/users for my-BizTalk-HOST-account are setup in the BizTalk databases with proper permissions
sending to any other receive location behaves fine, it's just those using the BTAHL72xReceivePipeline
Can anyone explain this or have a fix?

SQL Server 2012 DB mail failure

So, I never expected to spend 6 hours trying to get Send DBMail working on SQL Server 2012, but here we are.
I'm trying to simply set up an SMTP server to use with Database Mail. I've tried both Verizon and Google. I've tested the settings in Thunderbird, and yet I still receive the following error:
10/31/2013 14:56:30,,Error,The mail could not be sent to the recipients because of the mail server failure. (Sending Mail using Account 1 (2013-10-31T14:56:30). Exception Message: Cannot send mails to mail server. (The operation has timed out.).),7084,6932,6038,,10/31/2013 2:56:30 PM,sa
This is getting ridiculous, I've scoured the web for similar issues and solutions, and found lots of ideas that didn't work. I even started an clean AWS instance with Server 2012 and it has the same problem. I've disabled Windows Firewall and Defender, and honestly I'm stumped and frustrated.
If you have access to add a role to your server then I would add the TELNET client for smtp testing. Test your smtp config using the following TELNET commands:
C:/>TELNET <mail server> 25
EHLO <mail server>
<IF AUTH REQUIRED ENTER CREDENTIALS>
MAIL FROM:<any account#yourdomain.com>
RCPT TO:<where you want mail to go #domain.com>
DATA
<ENTER>
<MESSAGE>
<PRESS PERIOD(".")>
If you do not get errors in telnet and/or the logs then Database Mail should work fine using MAIL SERVER. You need to set up a profile and mail account in sqlserver but the wizard is straight forward. Next, add a few operators with valid email addresses and you should receive your notifications.
So after much stress, and trying a different server/version, I found that MailJet worked flawlessly, and I'm back up and running.
I think Steoleary is on to something that somewhere along the line, the connection is being silently blocked. Either way, for anyone who runs into this problem, try another mail server, and another one, and another one.
My guess is the database mail feature is acting as a relay, and Verizon and Gmail are blocking it.

Resources