| Author |
code for Database connection
|
Rekha Gaikwad
Ranch Hand
Joined: Jul 25, 2005
Posts: 36
|
|
Hi, I am developing an application using Java/JSP and web container is tomcat. Can anybody guide me how should I go abt writing connection class? Is it ok to make connection through servlet init method?
|
 |
Scott Selikoff
Saloon Keeper
Joined: Oct 23, 2005
Posts: 3666
|
|
Do you want to write your own connection class? Unless you're developing your own database, you generally want to use an exisitng Connection class with a JDBC driver that comes with your database. I'd recommenting using lazy instantiation (only create it the first time you need it) for your database connection for two reasons: 1) better performance overall 2) better control- you can close it after you are done so that you dont run out of connections
|
My Blog: Down Home Country Coding with Scott Selikoff
|
 |
Milan Jagatiya
Ranch Hand
Joined: Jan 01, 2007
Posts: 164
|
|
better you refer below link ...and go for "JDBC Data Sources"... it helps.... TOMCAT JNDI-RESOURCES
|
Milan.<br />I can because I think I can...
|
 |
Rekha Gaikwad
Ranch Hand
Joined: Jul 25, 2005
Posts: 36
|
|
|
Thanks for your help guys.Really Appreciate it!!!
|
 |
 |
|
|
subject: code for Database connection
|
|
|