To execute the sql from java, you perform the following steps:
- open a connection (700ms)
- prepare a statement (80ms)
- execute the statement (10ms)
Timing examples are from my environment for a simple statement. Your environment will be different, but the proportional amount of time will be similar. The point is that opening the connection can be far more expensive than actually executing the statement.
Check that your code is not opening a connection and preparing a statement inside of a loop. That could account for a big proportion of your time and explain why the script is slower then when launched with sql developer. You should open the connection once and then re-use the connection. If you are not uploading a large amount of data, then the amount of time the code takes to run on the database server is the same whether it was initiated from sql developer or some other client.