Hello all,
We have recently decided to standardize on
struts as our MVC web framework of choice. We have several apps with "home brewed" versions of the MVC framework. We don't use
EJB's.
I am starting to understand STRUTS pretty well know and just have a question regarding
JDBC.
In the older apps we implemented a connection factory class that was able to load the connection properties from a file and return a standard connection by calling an instance method or a static method. In the same method we would setup a sql statement and then execute the statement then close the connection. This was using Websphere's connection pooling.
Now with struts I realize that I would instantiate a connection either directly in the action class or in a support object that is declared/instantiated inside of the action class.
My question is does it make sense to create a "ConnectionFactory" class that gives you a standard connection and still open, execute, and close the object from within the same method?
OR
Create a wrapper class around a standard connection object and pass it around from one sql method to another sql method then return the connection object back to the method that originally opened it so that it can be closed?
OR
Another way that I am just not seeing.
I realize that there are probablly a couple dozen ways to setup jdbc I'm hoping to find a way that others have found it to work well in struts.
Thanks in advance.
Heath