Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JDBC Connection Utility: static class?

 
Irachi Chishima
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am writing a JDBC connection utility to connect Lotus Notes to an Oracle database. It can be called from different part of Notes (like different client classes) but I need to make sure that only one thread can have the database connection at a time (long story!). I am thinking about writing my connection utility class as with static synchronized methods. That way no two instances of the class could be calling the method at the same time (because of the lock set by "synchronized"). I am actually not planning to actually instantiated the class anyway since the only method I need is static. Will this guarantee that any client that uses my connection utility class will have exclusive control of the connection?
I am a newbie at this and am wondering if I am going about designing this the correct way. Any suggestions would be much appreciated. Thanks.
 
Vladimir Ergovic
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That should be just fine. I company where I worked some guys did just that like you and it was OK!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic