A third party program generates a .sql script in a file which I would like to run.
In my Java app, I already have a connection in a connection pool to the database, and I'd like to use that to run the .sql script in the file by simply calling a query or function.
The alternative is to run it through the command line, which I can do, but it means passing through the DB username and password which seems less secure than just reusing the same connection. I run on a mixture of Windows and Linux too, so if I can just run a postgres query / function that can run a .sql file (which resides on the same server as postgres itself) then that would seem to me to be the best solution.
All my searching so far has not revealed a solution (although no one has said it's not possible either)
Any ideas appreciated.
Start Free Trial