Java Code Examples for org.springframework.jdbc.core.JdbcTemplate#setQueryTimeout()
The following examples show how to use
org.springframework.jdbc.core.JdbcTemplate#setQueryTimeout() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DbConfig.java From graphouse with Apache License 2.0 | 5 votes |
@Bean public JdbcTemplate clickHouseJdbcTemplate( DataSource clickHouseDataSource, @Value("${graphouse.clickhouse.query-timeout-seconds}") int queryTimeoutSeconds ) { final JdbcTemplate jdbcTemplate = new JdbcTemplate(); jdbcTemplate.setDataSource(clickHouseDataSource); jdbcTemplate.setQueryTimeout(queryTimeoutSeconds); return jdbcTemplate; }
Example 2
Source File: DbConfig.java From graphouse with Apache License 2.0 | 5 votes |
@Bean public JdbcTemplate clickHouseJdbcTemplateAutohide( DataSource clickHouseDataSource, @Value("${graphouse.autohide.clickhouse.query-timeout-seconds}") int autoHideQueryTimeoutSeconds) { final JdbcTemplate jdbcTemplate = new JdbcTemplate(); jdbcTemplate.setDataSource(clickHouseDataSource); jdbcTemplate.setQueryTimeout(autoHideQueryTimeoutSeconds); return jdbcTemplate; }
Example 3
Source File: HiveConnectorClientConfig.java From metacat with Apache License 2.0 | 5 votes |
/** * hive metadata read JDBC template. Query timeout is set to control long running read queries. * * @param connectorContext connector config. * @param hiveDataSource hive data source * @return hive JDBC Template */ @Bean public JdbcTemplate hiveReadJdbcTemplate( final ConnectorContext connectorContext, @Qualifier("hiveDataSource") final DataSource hiveDataSource) { final JdbcTemplate result = new JdbcTemplate(hiveDataSource); result.setQueryTimeout(getDataStoreReadTimeout(connectorContext) / 1000); return result; }
Example 4
Source File: HiveConnectorClientConfig.java From metacat with Apache License 2.0 | 5 votes |
/** * hive metadata write JDBC template. Query timeout is set to control long running write queries. * * @param connectorContext connector config. * @param hiveDataSource hive data source * @return hive JDBC Template */ @Bean public JdbcTemplate hiveWriteJdbcTemplate( final ConnectorContext connectorContext, @Qualifier("hiveDataSource") final DataSource hiveDataSource) { final JdbcTemplate result = new JdbcTemplate(hiveDataSource); result.setQueryTimeout(getDataStoreWriteTimeout(connectorContext) / 1000); return result; }
Example 5
Source File: ShardJdbcTemplate.java From compass with Apache License 2.0 | 5 votes |
/** * 创建一个JdbcTemplate,并且设置超时、maxRows参数 * @param dataSource * @param config * @return */ private JdbcTemplate createJdbcTemplate(DataSource dataSource, ShardJdbcConfig config) { JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); jdbcTemplate.setQueryTimeout(config.getQueryTimeout()); jdbcTemplate.setMaxRows(config.getMaxRows()); return jdbcTemplate; }