Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Direct JDBC Connection Vs DataSource Connections

 
m prabhu
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what is the difference when
1.a web application uses a direct JDBC connection to interact with the RDBMS.
2.a web applciation uses a datasource functionality provided by the application server to interact with the RDBMS.

Please let me know the advantages and the disadvantages.

Regards,
Prabhu
 
Marut pandey
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you have DataSource setup, you can Use Server's JNDI service to access DataSource object which gives you flexibility in connecting with different database without changing anything in application or in WAR.

Suppose you have three kind of Environment (Dev,QA, Prod) each of them should connect to separate databases. If you have used DataSource setup along with JNDI name. You just need to call JNDL name in you application and server at each environment with connect with appropriate database. Assuming each server has their own DataSource configured.
 
vivek srivastava
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We can use connection pooling functionality in 2 one but not in first one.
 
m prabhu
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you, Vivek & Marut
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic