Обсуждение: how to modify connection socket timeout

Поиск
Список
Период
Сортировка

how to modify connection socket timeout

От
"Peirong Feng (pefeng)"
Дата:
Hi there,

It seems that the socket inside the connections returned by jdbc driver
has a fixed timeout value (30 seconds). Is there anyway we can set the
timeout for these sockets?

            Jdbc3PoolingDataSource dataSource = new
Jdbc3PoolingDataSource();
            dataSource.setDataSourceName("Test Source");
            dataSource.setServerName(REMOTE_HOST_);
            dataSource.setDatabaseName(DB_NAME);
            dataSource.setUser(DB_USER_);
            dataSource.setPassword(DB_PWD_);
            dataSource.setInitialConnections(INITIAL_CONNECTION_);
            dataSource.setMaxConnections(MAX_CONNECTION_);
            try{
                dataSource.setLoginTimeout(REMOTE_CONNECTION_TIMEOUT_);
            }catch(SQLException sqle){
                logger.warning(sqle.getMessage());
            }

The issue here is that once the pool is initialized and then we unplug
the cable, the connections inside pool don't realize that the connection
is gone and still timeout in 30 seconds.

Thanks.
Peirong