• Post Reply Bookmark Topic Watch Topic
  • New Topic

Design for DBInterface -- Feedback for proposed design  RSS feed

Manohar Karamballi
Ranch Hand
Posts: 227
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am following below mentioned approach for handling database transactions.
-- A class that have all static methods such as autheticateUser , getResults etc..(one method for each db transaction)..
-- Class has static initilizer that assign static datasource by JNDI lookup
-- Each time method is invoked Connection object is retrieved from static DataSource, database related things are done and closing connection.
-- If any exceptions are thrown I am closing connection and returning null from static method.
I need feedback regarding following points.
1. Is Initializing DataSource (and making it as static ) have ne side effects?
2. Is static method approach recommended?
3. Any performance penalty on getting connection from DataSource each time?
4. What is best way of handling exceptions? Is it good practice to return null object?
5. I am in notion that closing connection close all child objects such as Statements and Resultsets. Is this correct?
6. And ne comments regarding other drawbacks of proposed design and enhancements that could be done to this design...
My DBConnection i/f should support peak load of around 50 requests.
Aniticipating your valuable suggestions.
Thanks in advance.
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!