Servertec   Connection Pool Servlet
Content
Introduction
Release Notes
Features
FAQs
Requirements
Installation
Add-ons
How To
Change Log
Future Plans
Knowledge Base
Documentation
Samples
Hello World
Display Arguments
Display Headers
URL Redirect
CGI Tester
SSI Tester
Servlet Tag
Servlet Chaining
Log
Cookie Counter
Cookie Tester
Protected Page
List Employees
Connection Pool
Simple Form
Dump Form
Page Counter
File Upload
Session Tester
Context Tester
Sales
Legal
Feedback

 

This example only works under Windows NT/9x. The example makes use of the JDBC-ODBC bridge to access the employee table and may not work with JView.

Before this example can be used the following must be done:

  1. An entry must be defined as a System DSN using the ODBC Data Source Administrator from the Control Panel.
      Driver: Microsoft Access Driver (*mdb)
      Data Source Name: iob
      Database: iws_dir\databases\iob.mdb
    where:
    iws_dir is the directory where iServer was installed, normally c:\iws.

  2. The following Connection Pool entry must be defined using the iServer Administrator.
      Connection Pool: iob
      Driver: sun.jdbc.odbc.JdbcOdbcDriver
      URL: jdbc:odbc:iob
      Username:
      Password:
      Initial Size: 10
      Maximum Size: 20

  3. iServer must be restarted.

This example displays a table showing any existing rows in the employee table.

The example makes use of iob, a pool of connections that was created when the server was first started. Each time service() is called an attempt is made to acquire a connection from the pool. If a connection is available the servlet is able to process the client's request. When the servlet closed the connection or when the servlets exits, the connection is returned to the pool for later reuse. If no more connections are available in the pool then an exception is thrown and an error message is sent back to the user. All connections in the pool are finally closed when the server is stopped.

Connection pools are an efficient way of managing a limited resource.

[ view source ] [ run ]

 top of page
 Built with iScript Copyright © 1997-2000 Servertec. All rights reserved.
Last Modified: Thu Aug 10 13:07:08 EDT 2000