Skip to content

SocketTimeout

v-reye edited this page May 26, 2020 · 1 revision

As of 6.1.2, the Microsoft JDBC Driver for SQL Server supports setting the socket timeout on the connection.

There are now two ways to setup the socket timeout:

  • connection URL jdbc:sqlserver://localhost;userName=sa;password=PASSW0RD;database=master;socketTimeout=10000;
  • SQLServerDataSource object SQLServerDataSource#setSocketTimeout(int)
Property Type Default Description
socketTimeout int 0 The number of milliseconds to wait before a timeout is occurred on a socket read or accept. The default value is 0, which means infinite timeout.

As of 6.1.7, the Microsoft JDBC Driver for SQL Server supports a third way to setup the socket timeout:

  • Connection#setNetworkTimeout(Executor executor, int milliseconds)