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:
- 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.
- 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
- 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 ]
|