For loading and registering a driver you should use Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"), but I have used JdbcOdbcDriver j=new JdbcOdbcDriver() and I still get a connection. Why is this so? Why should I use Class.forName("");
Using Class.forName will create and initialize an instance of the class you pass in as a paramter. So using Class.forName will achieve the same result as creating an instance of the class and initializing it yourself. The benefits of using Class.forName are that the forName method throws a ClassNotFoundException, so in the case that the classes do not exist that you are trying to use, a ClassNotFoundException will be thrown and since you can't call the forName method without handling the exception in some way (catching or throwing the exception), your application will be better suited to handle this scenario whereas creating instances of the class yourself will not have this benefit (your application will have an unhandled exception and exit).