i am getting null pointer exception at the following line
stmt = con.createStatement();
int val = stmt.executeUpdate("INSERT INTO WEBDB.HNM VALUES('1','hRISHIKESH')");
Hint: you load the driver in the scope of a try block. You try to reuse it outside the scope of the try block.
What happens if you move line 31 and associated lines inside the try?
Can you post the full stack trace ? Apart from the driver name (I'm not sure about that driver class you have used) that code should work as it did for me.
Hrishikesh Maluskar wrote:we have to use the following directly or some settings have to be made
It's apparent that you are using a different driver. I think you should check the documentation of that to see how to connect. For mysql's driver this works fine.