In a simple jdbc example , when we load a driver through a java class, the practise is to use Class.forName("com.mysql.jdbc.Driver").newInstance();
Why we do not use new com.mysql.jdbc.Driver();
?
Asked
Active
Viewed 434 times
1 Answers
0
This piece of code isn't really intended to create an instance of the driver but to ensure the driver class is loaded by the class loader. Nowadays this is no longer needed, see:

Community
- 1
- 1

Tomasz Nurkiewicz
- 334,321
- 69
- 703
- 674