Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JDBC Connection in a Descriptor/XML file  RSS feed

 
Jawahar Rajan
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
All,
I am currently working on a web application that uses a backend oracle database.
So far I have been using JDBC as the connection to the database. I have been building the connection in a Servlet.
I know that this is not the best approach.
Could I put this information in a descriptor/XML file and what kind of tag would this involve. I mean just the JDBC name and the Database login information
OR
Would it be better to use Tag library, if so where could I find some examples.
Does this weeks book that is being given away talk about JDBC and where is the best place to have the connection string.
Thanks - all suggestions are appreciated.
Jawahar
 
Rick Salsa
Ranch Hand
Posts: 173
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jawahar,
Take a look at your Servlet container's documentation. Most will allow you specify a data source in its configuration file, which happens to be XML. I know for sure that Tomcat and JBoss do this. I'd be surprised if others didn't.
You could also factor out the code to create the database connection into its own class. This class could then be used for as a connection pool.
HTH,
/rick
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!