Hi All, Please help I am relatively new to java and even more recently to struts. I basically want to know what is the best way (best coding practice & J2EE)to connect to and use a DB with struts framework? The approaches that I have considered (using my limited experience) are:
1. I can specify DB in <data-sources> in struts-config and get connection etc in Actions to work and e.g. check logon id in LogonAction. However, is this the best place for the DB interaction to be coded? All example applications that I have seen take this simple approach. This way the DB configuration is central and easily managed. 2. Using a DataServices or DataAccess Layer where the connection to DB and all DB interaction is handled. A previous framework that we used had a BusinessObject containing a DataObject and called the DataService from the BusinessObject. We can do something similar with struts, however each DataService e.g. to validate logon ID and password use the UserDS which has the connection string inside it. This defeats using struts to centrally manage the datasource. Also using this approach cannot read the <data-source> from struts-config as no access to the ServletContext outside of the Action? Is this correct? Is it OK to make the connection in the Action and pass it to a parameter to the BusinessObject/Bean? What methods do people use? If you have any example code with DB connections etc it would save us re-inventing the wheel... :-). Also, is there any potential problems with connections using the above approaches if I only open and close them as needed? Apologies if these are stupid/simple questions! Thanks, Mark --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

