Gayan,
JDBC drivers map database data types to java classes.
Hence from your code, the variables
time1 and
time2 must be instances of the java class that maps to the BIGINT database data type.
It is not clear to me from the code you posted whether this is the case.
I have no experience with
mySQL and therefore do not know what java class maps to BIGINT.
I suggest trying the documentation for the JDBC driver you are using.
Good Luck,
Avi.