[jcifs] jTDS + jCIFS works!

Eric Glass eric.glass at gmail.com
Thu Jul 22 09:49:41 GMT 2004


> However, when using a named pipe with jCIFS to SQL Server 6.5, I am
> unable to set the SmbTransport.SO_TIMEOUT or RESPONSE_TIMEOUT values
> correctly using code like the following.  (My guess is that the
> SmbTransport objects have already been created such that setting these
> values in the Config object doesn't do anything.)
> 
>  Config.setProperty("jcifs.smb.client.soTimeout", String.valueOf(timeout));
>  Config.setProperty("jcifs.smb.client.responseTimeout", String.valueOf(timeout));
> 

There wouldn't be a "clean" way to implement this scenario with jCIFS.
 The config properties are intended to be set at or about application
startup; the general assumption is that they won't change during
execution.  Additionally, jCIFS multiplexes SMB sessions over
transports; if you open 5 connections to the same server, all 5
sessions will typically run over the same physical connection to the
server (a single transport).  So the timeout would only occur if there
was no activity over the transport for *any* of the active sessions.

It is possible to set "jcifs.smb.client.ssnLimit" to 1, which will
maintain a one-to-one relationship between sessions and transports
(effectively disabling multiplexing).  However, SmbTransport will
still read the timeout config properties once during initialization
and cache the values; you wouldn't be able to change them at runtime
(which is what you're looking to do).  You could modify SmbTransport
to read the config property every time, but that's really a kludge
solution.

As Mike indicated, SMB transactions have a timeout field which you
could play with; the ideal approach would be to employ TDS protocol
support for this (if there is any).


Eric


More information about the jcifs mailing list