Servertec   ConnectionPoolManager
Content
Introduction
Release Notes
Features
FAQs
Requirements
Installation
Change Log
Future Plans
Knowledge Base
Documentation
Conventions
Users
Reference
iServer API
Connection
PoolManager

Servlet API
CGI
SSI
Servlets
Logs

Samples
Sales
Legal
Feedback

 

java.lang.Object
 |
 +--stec.sql.ConnectionPoolManager

public class ConnectionPoolManager extends Object

Used to manage access to connection pools. Connection pools can be defined using the iServer Administrator or created using the ConnectionPoolManager.

This class is a wrapper for java.sql.ConnectionPoolManager. It is primarily used to return a connection from an existing connection pool.

Methods

Method Description
createConnectionPool Creates a new connection pool.
destroyConnectionPool Removes an existing connection pool.
destroyAllConnectionPools Removes all existing connection pools.
getConnection Returns a connection from the named connection pool.
getConnectionPools Returns an enumeration of the connection pools.

createConnectionPool

Creates a new connection pool.

Syntax

public static void createConnectionPool(String name,
                                        String driver,
                                        String url,
                                        int initSize,
                                        int maxSize)
                                        throws Exception

public static void createConnectionPool(String name,
                                        String driver,
                                        String url,
                                        String username,
                                        String password,
                                        int initSize,
                                        int maxSize)
                                        throws Exception

public static void createConnectionPool(String name,
                                        String driver,
                                        String url,
                                        Properties info,
                                        int initSize,
                                        int maxSize)
                                        throws Exception

Parameters

name the name of the connection pool.
driver the JDBC driver to the database.
url the url to the database.
username the user's id.
password the user's password.
info any connection arguments, key/value pairs.
initSize the initial number of connections.
maxSize the maximum number of connections.

Returns

Nothing.

Throws

Exception if an error occurs.

Example

ConnectionPoolManager.createConnectionPool
(
    "advworks",
    "sun.jdbc.odbc.JdbcOdbcDriver",
    "jdbc:odbc:AdvWorks",
    10,
    20
);

destroyConnectionPool

Removes an existing connection pool.

Syntax

public static void destroyConnectionPool(string name) throws Exception

Parameters

name the name of a connection pool.

Returns

Nothing.

Throws

Nothing.

Example

ConnectionPoolManager.destroyConnectionPool("advworks");

destroyAllConnectionPools

Removes all existing connection pools.

Syntax

public static void destroyAllConnectionPools() throws Exception

Parameters

None.

Returns

Nothing.

Throws

Nothing.

Example

ConnectionPoolManager.destroyAllConnectionPools();

getConnection

Returns a connection from the named connection pool.

Syntax

public static Connection getConnection(string name) throws Exception

Parameters

name the name of a connection pool.

Returns

Connection the connection. null if all connections are in use.

Throws

Exception if an error occurs.

Example

Connection con = ConnectionPoolManager.getConnection("advworks");

getConnectionPools

Returns an enumeration of the connection pools.

Syntax

public static Enumeration getConnectionPools()

Parameters

None.

Returns

Enumeration the enumeration of the connection pools.

Throws

Nothing.

Example

Enumeration e = ConnectionPoolManager.getConnnectionPools();
 top of page
 Built with iScript Copyright © 1997-1999 Servertec. All rights reserved.
Last Modified: Tue Jan 26 22:59:10 EST 1999