• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Michael Boehm
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Pie
Posts: 20729
30
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 48381
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving to our JDBC forum.
 
Michael Boehm
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic