The document mentioned in the following link says:

When using the sqljdbc4.jar class library, applications do not need to explicitly register or load the driver by using the Class.forName method. When the getConnection method of the DriverManager class is called, an appropriate driver is located from the set of registered JDBC drivers. For more information, see Using the JDBC Driver.

Link: Working with a Connection

The why do I get the following error when I remove the following line from my code?

Java Code:

Error while catching the following exception. My catch block and error are as follows:

Java Code:
     catch(SQLException ex2){
                                                                                                            System.out.println("Stacktrace Below:");
                 System.out.println("Error Trace in Connection : " + ex2.getMessage());

    Stacktrace Below:
    Error Trace in Connection : No suitable driver found for jdbc:sqlserver://;database*​Name=MyDatabase
    java.sql.SQLException: No suitable driver found for jdbc:sqlserver://;database*​Name=MyDatabase
    	at java.sql.DriverManager.getConnection(
    	at java.sql.DriverManager.getConnection(
    	at javafx.concurrent.Task$

I have the `sqljdbc4.jar` file in my Netbeans library as follows:

1) Do I need to specify any class path in Netbeans?

2) Should the `sqljdbc4.jar` be inside the same folder like other jar files?

Not using Class.forName as per documentation is producing error-jar.jpg