That sounds weird. Are you sure that the expected database operation is
being performed when the connection is established in execute()? Please add
logs and see whether the expected results are generated.

Program should not fail in both cases ideally. Only point is that the
driver should be within the class path.

Once you resolve this issue by establishing connection in prepare(), please
try to have connection renewal mechanism(by firing query to database
periodically or using a suitable connection pool). This is to avoid
connection timeouts during times of low traffic.

Richards Peter.

Reply via email to