Let's suppose an exception is thrown before a value is assigned to the "connection" variable. You catch that exception and print a message. Then you carry on and try to use the "connection" variable, which is still null.
As you imply, the real problem is something else, namely something to do with loading the driver class. Your code printed the exception, which you didn't share with us. So read it and act accordingly.
Joined: Mar 04, 2008
Thanks Paul. This is the exception I ma getting. It doesn't seem that problem with loading driver. I get the value of the drive printed in the output.
java.lang.NullPointerException at tests.functional.cartridge.spatial.common.apps.spatial_cartridge.SpatialDBHelper.getJDBCConnection(SpatialDBHelper.java:53)