Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Design for DBInterface -- Feedback for proposed design

 
Manohar Karamballi
Ranch Hand
Posts: 227
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
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.
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!