i tried to rewrite the codes to see if i was able to solve the problem, but what i noticed is that your insert statement had no ( " ") to show if you were trying to input a string or and integer data type into your database, this is important as it is need to verify that the data type of the program matches that of the database..and equaling the connection variable to null is not necessary either(Connection con =null);
NB. When inputting sting in the database a (' ') is needed and none when inputting an integer or double data type.
I wasn't able to run it to see what the outcome was but take a shot and let me know what the error is if any received
regards