If query takes only 4 seconds on Oracle side I would say connectivity is the issue.
Here is how you can trace Oracle side of the query...
Set your environment... e.g. ORACLE_HOME and ORACLE_SID
Initiate a SQLPlus session...
alter session set timed_statistics = true;
alter session set sql_trace = true;
set autotrace on explain
alter session set events='10046 trace name context forever, level 12';
++ EXECUTE TROUBLED SQL ++
alter session set sql_trace = false;
alter session set timed_statistics = false;
show parameter user_dump_destination
Go to whatever place user_dump_destination is pointing
tkprof the last large *.trc file you see there
Look at *.trf file looking for Wait Events section
_____________________________________
Pablo (Paul) Berzukov
Author of Understanding Database Administration available at Amazon and other bookstores.
Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.