New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use connect timeout while establishing (socket) connection [JDBC279] #325
Comments
Modified by: @mrotteveel |
Commented by: @mrotteveel Scheduled for 2.3, if easy/small also backport to 2.2.2 |
Modified by: @mrotteveelFix Version: Jaybird 2.3 [ 10440 ] |
Commented by: hugo Larsson (hugol) It would be fantastic if this feature could be implemented in version 2.2.2 |
Commented by: @mrotteveel Firebird has the dpb item isc_dpb_connect_timeout which is the connect timeout in seconds. I will add support in Jaybird for this dpb item, which will fallback to the loginTimeout specified in DriverManager. If no timeout is specified (and DriverManager.getLoginTimeout() returns 0), then the timeout will be OS dependent (for example: about 20 seconds on Windows 8). This also means the timeout cannot have a subsecond value. I could add a millisecond variant, but that would only work for the pure java driver and not for the JNI driver. |
Commented by: @mrotteveel Got it working for pure java, but the native library seems to ignore the isc_dpb_connect_timeout item. |
Commented by: @mrotteveel Committed implementation to trunk, it however won't work with native (where isc_dpb_connect_timeout seems to be a timeout for executing op_accept after establishing the socket connection). Will need to look into this further, also if I need to use the connectTimeout in the pure-java implementation as the SoTimeout during the op_accept fase. Potential workaround for the lack of a socket connect timeout with native would be to construct an InetAddress and call isReachable with the timeout, but I am not sure if that is a good idea, because establishing a connection on a slow link might take even longer. |
Commented by: @mrotteveel Added subtask to backport to 2.2.2 |
Modified by: @mrotteveelstatus: Resolved [ 5 ] => Closed [ 6 ] |
Submitted by: @mrotteveel
Is related to JDBC238
Jira_subtask_outward JDBC295
Votes: 1
The Jaybird wire protocol currently doesn't use a connect timeout, this means that in some cases a connection will actually fail after a considerably long time (depends on the socket connect timeout of the underlying OS and other factors; theoretically it could be indefinitely).
Change Jaybird to use unconnected sockets and use the connect method that uses a timeout. Consider if this needs to be a connection property, or if the DriverManager.getLoginTimeout() should be used (see http://docs.oracle.com/javase/7/docs/api/java/sql/DriverManager.html#getLoginTimeout() ) or a combination of these options.
Also check if (and how) this could be applied to the native driver.
Commits: e9d32c0 5fe0bea
The text was updated successfully, but these errors were encountered: