Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How is it able to connect to database even if jdbc driver is not loaded

 
Rajiv KumarRai
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Hi,
When I run the above code , am able to get the results from database.
But I cant understand how is it so as the code line which loads the jdbc driver
is commented.

Please shed some light on the above issue.

Thanks
 
K. Tsang
Bartender
Posts: 3583
16
Android Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you using JDBC 4.0 driver? If so the tutorial here states that

DriverManager: This fully implemented class connects an application to a data source, which is specified by a database URL. When this class first attempts to establish a connection, it automatically loads any JDBC 4.0 drivers found within the class path. Note that your application must manually load any JDBC drivers prior to version 4.0.


If not the Class.forName(....) line would be needed.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic