File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes Direct JDBC Connection Vs DataSource Connection Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Direct JDBC Connection Vs DataSource Connection" Watch "Direct JDBC Connection Vs DataSource Connection" New topic
Author

Direct JDBC Connection Vs DataSource Connection

m prabhu
Ranch Hand

Joined: Jan 29, 2008
Posts: 79
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
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9243
    
    1

With the first approach, you have to manually manage transactions, database connection pooling and stuff but with the latter, you get that from the container.


SCJP 1.4, SCWCD 1.4 - Hints for you, SCBCD Hints - Demnachst, SCDJWS - Auch Demnachst
Did a rm -R / to find out that I lost my entire Linux installation!
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

Jothi Shankar Kumar wrote:With the first approach, you have to manually manage transactions, database connection pooling and stuff but with the latter, you get that from the container.


either direct jdbc connection(type1) nor datasource support implicit transaction, thats is your own logic.

and read this why ConnectionPooling is prefer over JDBC connection
Lucas Smith
Ranch Hand

Joined: Apr 20, 2009
Posts: 804
    
    1

This question is not about SCWCD. It should be moved to different place.


SCJP6, SCWCD5, OCE:EJBD6.
BLOG: http://leakfromjavaheap.blogspot.com
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Direct JDBC Connection Vs DataSource Connection
 
Similar Threads
Singleton for datasource?
Using database roles in a J2EE application
What sort of connectivity does JDBC provides.
Direct JDBC Connection Vs DataSource Connections
database-access JavaBean - thread safety