SCJP 1.4
Retire your iPod and start with HD Android music player Kamerton | Minimal J2EE container is here | Light weight full J2EE stack | and build tool | Co-author of "Windows programming in Turbo Pascal"
SCJP 1.4
Retire your iPod and start with HD Android music player Kamerton | Minimal J2EE container is here | Light weight full J2EE stack | and build tool | Co-author of "Windows programming in Turbo Pascal"
SCJP 1.4
Originally posted by Giovanni De Stefano:
Thanks,
I actually would like to know if setting a database connection as a context attribute is the "right" way to provide database access to the web app, or should I do it with JSP?
Giovanni
[ May 09, 2005: Message edited by: Giovanni De Stefano ]
Retire your iPod and start with HD Android music player Kamerton | Minimal J2EE container is here | Light weight full J2EE stack | and build tool | Co-author of "Windows programming in Turbo Pascal"
Originally posted by D Rog:
Accordingly last research(?) connection pooling is quite obsolete since creation connection takes much less time than it was before. From other side smart JDBC driver can orginize internal connection pooling. Actually as only you choose connection pooling you get a lot of parameters to configure and you do not really may have a clue how. For a not very complex web app I'd store database connection parameters in a static variable. As we just figured it's quite reasonable since context data do not replicate accross clusters, but very unlikely a servlet container will use a separate class loader for every instance of the same servlet, and even in this case you should be safe.
SCJP 1.4
Retire your iPod and start with HD Android music player Kamerton | Minimal J2EE container is here | Light weight full J2EE stack | and build tool | Co-author of "Windows programming in Turbo Pascal"
Originally posted by Giovanni De Stefano:
From Head First Servlet & JSP, page 54: the model is the only part of the system that talks to the database...
/QUOTE]
Mmmm, well, here I do not agree. I've seen web applications where the JSP takes care of the database connection, the servlet, or the DAO or Data Access Object. But never the model, as I see it. The model is just the collection of javabeans which reflects the concepts known to the user like Client, Product, Order, Orderline and so on.
In my opinion, the best way to follow the MVC model 2 is to provide DAO's or Data Acces Objects which connect to the database and execute the SQL statements.
Originally posted by Gert Cuppens:
Mmmm, well, here I do not agree. I've seen web applications where the JSP takes care of the database connection, the servlet, or the DAO or Data Access Object.
Maybe he went home and went to bed. And took this tiny ad with him:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
|