• +91 9723535972
  • info@interviewmaterial.com

Struts Interview Questions and Answers

Question - If this struts class is not a good candidate, can someone recommend a similar pool-manager that is lean and mean and easy to use?

Answer - The Struts 1.0 GenericDataSource is not a good candidate for a production server. In Struts 1.1, the Commons DBCP is used istead, which is a good candidate for a production server. (You can also use the DBCP in Struts 1.0 by specifying the type and including the Commons JARs.) Another popular choice is Poolman. It's not under active development, but I believe you can still download it from SourceForge. Poolman is also very easy to use outside of Struts. Many containers also offer support for connection pools. The one that ships with Resin is quite good. The later versions of Tomcat bundle the Commons DBCP. Regardless of what pool you use, a good practice is to hide it behind some type of adaptor class of your own (often a singleton), to make it easy to change later. So your classes call your adaptor, and your adaptor calls whichever pool you are using. A neat and often-overlooked aspect of the Struts DataSource manager is that it supports loading multiple connection pools and giving each a name. So you might have one pool for internal use and another for public use. This way, the public connections can't swap your administrative access to the application. Each pool could also have its own login, and therefore different rights to the underlying database.     int i=1; with Struts 1.0 and jdbc i'am use GenericDataSource not in struts-xml, but in Client.properties my Client.properties instanceBd=oraID userPasswd=xxx/yyyy maxCount=20 minCount=19 port=1521 driver=oracle.jdbc.driver.OracleDriver url=jdbc:oracle:thin:@serverName:port:instanceBd then, on my code i have init (struts 1.0 or struts 1.1): GenericDataSource ng = new GenericDataSource (); ng.setUser (mprop.getUserBd()); ng.setPassword (mprop.getPasswdBd()); ng.setUrl (mprop.getUrl()); ng.setDriverClass(mprop.getDriverClass()); ng.setMaxCount(mprop.getMaxCount()); ng.setMinCount (mprop.getMinCount()); ng.setDescription("jdbc OracleDriver"); ng.setAutoCommit(true); try { ng.open(); } catch (java.sql.SQLException e) { } in bu

Comment(S)

Show all Coment

Leave a Comment




NCERT Solutions

 

Share your email for latest updates

Name:
Email:

Our partners