The default JDBCDataSource maxReconnectAttempts value is zero (0) when unspecified or in a newly created HOCON configuration file. when using Studio project right-click menu: New > StreamBase HOCON Configuration File.
The key settings are:
configuration = {
JDBCDataSourceGroup = {
jdbcDataSources = {
MySource1 = {
maxReconnectAttempts = -1
reconnectSleepMilliseconds = 2000
For this example, after disconnection the application will attempt to reconnect to this JDBC data-source (named "MySource1") every two seconds until reconnection succeeds. The Streaming application will not shut down because of this error. Reads will block indefinitely. Writes will queue indefinitely.
These settings also cause initial connection failure to retry, even if there is a permanent error condition such as:
ERROR com.streambase.sb.expr.DataSourceInfoImpl: Exception while trying to establish JDBC connection, attempt 4:
Unable to load JDBC Driver class com.example.jdbc.Driver
If the JDBC connection is not restored in a timely manner, blocking and queuing may case the application to fail in other ways specific to the application.
Additional Considerations:
- Different JDBC data-sources are independent of each other and have their own retry settings.
- Different non-shared connections to the same data-source have their own connection status and retry count.
- Shared connections share connection status and will disconnect and reconnect together.
- The use of a connection pool does not affect disconnect, retry, or reconnect behavior.
- Typechecking retry behavior is independent of runtime data-source retry behavior.
- Disconnections initiated by the Streaming application or administrator will not trigger connection retries regardless of retry settings.
- SQL State error values that match the current reconnectRegexps setting force disconnection and reconnection retries according to the current retry settings. The default reconnectRegexps value is ".*" (period-asterisk) which means any received SQL State error value causes Streaming to disconnect and attempt to re-connect.
- Disconnecting an idle connection by using connectionTimeoutMilliseconds does not trigger retry attempts. Instead a failure to connect the new connection when the next JDBC operation is attempted will trigger new retries.
- Disconnections caused by an event external to the Streaming application will trigger connection retries except for SQL State error values that match the current dontReconnectRegexps setting. This setting causes the application to re-submit the SQL statement using the current connection when the SQL State error value matches (for example, SQL State value "40001" indicates a temporary condition such as timeout or resource limitation).