• 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
Pie
Posts: 65342
97
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic