Каталог статей
Меню сайта


Форма входа


Категории раздела
WebLogic administration and programming [7]
JSF and Primefaces [1]
Java general programming [12]
Other Java problems [11]
JPA and Hibernate [2]
Spring [2]
Spring


Поиск


Друзья сайта
  • Официальный блог
  • Сообщество uCoz
  • FAQ по системе
  • Инструкции для uCoz


  • Статистика

    Онлайн всего: 1
    Гостей: 1
    Пользователей: 0


    Приветствую Вас, Гость · RSS 20.05.2024, 14:04
    Главная » Статьи » Java » Other Java problems

    Purging connections from JDBC connection pool

    http://docs.oracle.com/cd/E24329_01/web.1211/e24376/phys_conr.htm#JDBCP1037

    http://docs.tpu.ru/docs/oracle/en/fmw/11.1.1.6.0/apirefs.1111/e13941/toc.htm

     

    There are special tasks when we need to explicitly close physical connection to the database: clean errors on the connection for example.

    General standard solution does not exist but for WebLogic data source we can do the following:

    1. Ensure that "Remove Infected Connections Enabled" option is set to true; true is default.

    2. For dismissing connection from a connection pool call ( (WLConnection) connection).getVendorConnection() and close the pooled connection:

    connection.close()

     

    From Oracle document:

    When Remove infected Connections Enabled=true (default value) and you close the logical connection, the server instance discards the underlying physical connection and creates a new connection to replace it. This action ensures that the pool can guarantee to the next user that they are the sole user of the pool connection. This configuration provides a simple and safe way to close a connection. However, there is a performance loss because:

        The physical connection is replaced with a new database connection in the connection pool, which uses resources on both the application server and the database server.

        The statement cache for the original connection is closed and a new cache is opened for the new connection. Therefore, the performance gains from using the statement cache are lost.

    Note:

    Oracle provides another mechanism to access a physical connection getVendorConnectionSafe. This mechanism also returns the underlying physical connection (the vendor connection) from a pooled database connection (a logical connection). However, when the connection is closed, it is returned to the pool, independent of the setting of Remove Infected Connections Enabled. For more information, see getVendorConnectionSafe.

    Категория: Other Java problems | Добавил: basil (29.04.2015)
    Просмотров: 491 | Рейтинг: 0.0/0
    Всего комментариев: 0
    Имя *:
    Email *:
    Код *:
    Бесплатный конструктор сайтов - uCoz