Yes this can be set in the JDBC driver by providing the appropriate DataSource properties (configured within the cd_storage_conf.xml).
See below for details about the timeout properties for the JDBC driver:
https://learn.microsoft.com/en-us/sql/connect/jdbc/understand-timeouts?view=sql-server-ver16These can be added to the storage_conf as below:
<Storage Class="com.tridion.storage.persistence.JPADAOFactory" Id="defaultdb" Type="persistence" dialect="MSSQL">
<Pool AcquireRetryAttempts="${dbretryattempts:-1}" Type="jdbc" connectionTimeout="120000" keepaliveTime="60000" maxLifetime="300000" maximumPoolSize="${dbpoolsize:-20}"/>
<DataSource Class="com.microsoft.sqlserver.jdbc.SQLServerDataSource">
<Property Name="serverName" Value="xxxxxxxx/>
<Property Name="portNumber" Value="1433"/>
<Property Name="databaseName" Value="xxxxx"/>
<Property Name="user" Value="xxxx"/>
<Property Name="password" Value="xxxx"/>
<Property Name="loginTimeout" Value="${dblogintimeout:-220}"/>
<!-- SQL Server JDBC specific properties -->
<Property Name="encrypt" Value="${dbencrypt:-false}"/>
<!-- Add your timeout properties -->
<Property Name="queryTimeout" Value="xxxx"/>
<Property Name="cancelQueryTimeout" Value="xxxx"/>
</DataSource>
</Storage>
Please note the sum of queryTimeout and cancelQueryTimeout values must be lower than the expected query execution time and both are required.