Whenever I try to execute the query in Splunk DB Connect (Data Input), I get the below error:
External search command 'dbxquery' returned error code 1. Script output = "RuntimeError: Failed to run query: "(select * from ocs_admin.tp_customerorder where plandate between sysdate-5 and sysdate and ticketnumber is not null)", params: "None", caused by: Exception(' java.sql.SQLTransientConnectionException: ocsdprd_splunk_srv - Connection is not available, request timed out after 30000ms..',). "
Is there a way to fix this?
Your connection is timing out after 30 seconds. I don't know a way to change the timeout setting so I suggest you look at ways to reduce the query time.
Are there any errors reported on the other end?
I noticed that splunk is refusing to connect to the database many times.
Sometime the query works and sometime it does not.
Not sure what is going wrong.
Try updating to DB Connect 2 version 2.4.0. I was running DB Connect 2 version 2.3.4. I was getting the same error of a 30 second timeout until I upgraded to version 2.4.0. Now the query works fine and I don't see the 30 second timeout.
I was also get this 30000ms timeout message in my dbx2.log for cronned Splunk DB searches. The query would work fine in the DB Connect, Search tab, but it wouldn't work as a cronned search. I would get a blank email with no query results and I would see the 30000ms timeout in the dbx2.log. The fix was adding "maxWaitMillis = 60000" in the /etc/apps/splunkappdbconnect/local/dbconnections.conf to the specific DB connection you are trying to run it on.
We were on 2.3.1 and had a lot of the connection timeout errors. The upgrade to 2.4 was the fix !!
You should click
Accept to close the question.
For what it's worth, I see this in DB Connect 2.4.0 as well, either running saved searches or ad-hoc searches. The problem is intermittent and the same query runs in less than 10 seconds in SQL Studio.