My issue is, first time I am creating the table and inserting some rows of data. After doing some logic going to delete that table . I am observing application is getting hang while executing statement.execute().
Please suggest me how to fix this issue.
I am assuming your statement.execute includes something like
"drop table <yourtable>"
did you make ABSOLUTELY sure that no part of your (or any other running) programm is still "interested" in that table?
as in "maybe some ORM-mapper still has a transaction open into that table"?
Because dropping a locked table has to wait until the lock is gone to complete. (esp. if there is an implicit commit in your execute; which may or may not be, depending on your connection-configuration)