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 JDBC: Implementation of javax.sql.DataSource in Connect/J ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "JDBC: Implementation of javax.sql.DataSource in Connect/J ?" Watch "JDBC: Implementation of javax.sql.DataSource in Connect/J ?" New topic
Author

JDBC: Implementation of javax.sql.DataSource in Connect/J ?

Michael Boehm
Ranch Hand

Joined: Jun 02, 2010
Posts: 51
I am wanting to try to use the MySQL driver from the official MySQL site. Reading tutorials it seems that getting a Connection using DriverManager is not the prefered method. Instead one should use an implementation of DataSource which exists eg. in org.apache.derby.jdbc. But I can find no class in com.mysql.jdbc implementing DataSource, so
does the official JDBC driver package (Connect/J) from MySQL itself not have an implementation of the class that is used in the prefered way of getting a Connection ?
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

I'm surprised that a tutorial would suggest you should use a DataSource, but then not go on to provide an example. Could you post a link to some of these incomplete tutorials?
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

The only tutorials I know of are things like this:

http://dev.mysql.com/doc/refman/5.0/en/connector-j-usagenotes-j2ee.html

But it has examples.

(I thought com.mysql.jdbc.jdbc2.optional.MysqlDataSource and a couple of other classes in optional implemented DataSource?)
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 37936
    
  22
Moving to our JDBC forum.
Michael Boehm
Ranch Hand

Joined: Jun 02, 2010
Posts: 51
Thank you for the answers. I had started out reading Sun's tutorial on JDBC where I first read that one should stick with the DataSource solution and there was an example using org.apache.derby.jdbc.ClientDataSource. Then I moved on to MySQL's tutorial and missed the two lines where there was a reference to the optional package (com.mysql.jdbc.jdbc2.optional.MysqlDataSource). There is an example using DataSource at MySQL I see now, but it is "hidden" in an Enterprise Edition section.
 
Don't get me started about those stupid light bulbs.
 
subject: JDBC: Implementation of javax.sql.DataSource in Connect/J ?
 
Similar Threads
BMP, Jboss, and mysql configuring
10 g App Server versus Weblogic versus Websphere
MySQL Connection Pooling
Java beans + JDBC
How JDBC API works?