connection pool implementation
hi friends i created my own connection pool class,iam used that sucessively by creating the connection pool object before the creation of serversocket and then passes the connection pool object after the client socket connected.It works fine in this core java application.I need
to implement my own class in struts application.In that before starting my web application i need to initialise my connection pool class object then i wil pass to my application...?how can i achieve this...?any suggestion for this problem....
[534 byte] By [
83Krisha] at [2007-11-27 11:24:31]

# 1
In your cental servlet in Struts, create a private static class variable called datasource (private static Datasouce datasource;l)
in the init() method, create you connection pool and assign it to the datasource reference.
Create a public static Datasource getDataSource() function and return the datasource reference.
Now any class that needs your datasource, it calls DataSource.getDataSource().
In any function needing a connection, within a try/catch/finally block, get a connection (dataSource.getConnection() ), use it, then close it in the finally block.
Dont pass connection objects between functions or through request scope. You can find examples of all this in google.