davsclaus commented on code in PR #30060:
URL: https://github.com/apache/camel/pull/30060#discussion_r4580473363


##########
components/camel-jdbc/src/main/docs/jdbc-component.adoc:
##########
@@ -179,6 +179,43 @@ from("direct:projects")
     .to("jdbc:myDataSource?useHeadersAsParameters=true");
 ----
 
+=== Noticing a dead or silent database
+
+The JDBC component has no network timeout of its own: how long the producer 
waits for a database that stopped
+answering depends on the JDBC driver and the connection pool of the 
`DataSource`. The durations below describe how
+those libraries behave by default; they are approximate, not guarantees of 
Camel.
+
+The common JDBC drivers have no read timeout by default. A statement on a 
connection that went silent (the database
+host is gone, or a firewall or NAT dropped the connection without a reset) 
waits in a socket read, with no error and
+nothing logged, until the operating system gives up on the connection: on 
Linux about 15 minutes when the request was
+not acknowledged, and never when it was and TCP keep-alive is off. Set the 
driver's socket timeout, longer than your
+slowest statement, so the producer fails and the error handler can redeliver:
+
+[cols="2,2,1,1"]
+|===
+| Driver | Property | Unit | Default
+
+| PostgreSQL (pgjdbc) | `socketTimeout` | seconds | 0 (no timeout)
+| MySQL Connector/J | `socketTimeout` | milliseconds | 0 (no timeout)
+| MariaDB Connector/J | `socketTimeout` | milliseconds | 0 (no timeout)
+| Microsoft SQL Server (mssql-jdbc) | `socketTimeout` | milliseconds | 0 (no 
timeout)
+| Oracle (thin driver) | `oracle.jdbc.ReadTimeout` | milliseconds | not set 
(no timeout)
+|===
+
+For example `jdbc:postgresql://db:5432/orders?socketTimeout=30` in the JDBC 
URL, or the same property as a driver
+property of the pool.
+
+After a socket timeout or a reset the connection is broken, and the pool must 
not hand it out again. HikariCP and the
+Agroal pool that Quarkus configures drop it by default; Agroal used directly 
needs a connection validator and an
+exception sorter. See 
xref:sql-component.adoc#_noticing_a_dead_or_silent_database[Noticing a dead or 
silent database]
+in the SQL component for the pool settings, Spring Boot and Quarkus 
properties, and starting while the database is
+down.
+
+NOTE: With the default `resetAutoCommit=true` the producer commits right after 
running the statement, before a

Review Comment:
   This note is out of date since #30083 (CAMEL-26997) was merged: with 
`outputType=StreamList` the producer no longer commits right after running the 
statement, but when the exchange is done. On PostgreSQL a `statement.fetchSize` 
then works with the default `resetAutoCommit=true`; main now says so in the 
`StreamList` example section ("the PostgreSQL driver fetches 
`statement.fetchSize` rows at a time only when auto-commit is off (as 
`resetAutoCommit=true` sets it)").
   
   Could you drop this NOTE as well, like the redelivery note in your last 
commit, and regenerate the catalog copy?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to