1

can we use anything else instead of Class.forName() for loading a driver for jdbc connectivity i.e is first step of jdbc connection?

SpringLearner
  • 13,546
  • 20
  • 71
  • 113

2 Answers2

2

can we use anything else instead of "Class.forname" for loading a driver for jdbc connectivity i.e is first step of jdbc connection?

You haven't even needed that since JDBC 4.1. Just call DriverManager.getConnection() with an appropriate URL.

Mark Rotteveel
  • 90,369
  • 161
  • 124
  • 175
user207421
  • 298,294
  • 41
  • 291
  • 462
0

Just import java.sql.Driver and invoke DriverManager.getConnecion() to establish a database connection. You don't really need to call Call.forName() these days (java7).