• Post Reply Bookmark Topic Watch Topic
  • New Topic

Creating separate JDBC bean class

 
shivang sarawagi
Ranch Hand
Posts: 159
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to create a separate .java file for the JDBC Connection so that I don't have to duplicate the JDBC code in all the servlets. Can anyone tell me how to do that ?? Thanks
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65664
129
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You'd be better off using container-managed connection pooling.
 
William P O'Sullivan
Ranch Hand
Posts: 859
Chrome IBM DB2 Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If it's just the connection logic, then Bear is right.

Otherwise use standard OO principles, write once and extend.

WP
 
grapes are vegan food pellets. Eat this tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!