Advertisement

01.16.2008 at 02:37AM PST, ID: 23086512
[x]
Attachment Details

In Postgres, is it possible  to execute a .sql file from a query or function

Asked by sl311 in PostgreSQL Database

Tags: Postgres, Postgres, 8.2

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
[+][-]01.16.2008 at 02:56AM PST, ID: 20670634

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01.16.2008 at 05:13AM PST, ID: 20671421

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01.16.2008 at 05:21AM PST, ID: 20671479

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01.16.2008 at 06:24AM PST, ID: 20672099

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01.16.2008 at 12:24PM PST, ID: 20675694

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]01.20.2008 at 04:07AM PST, ID: 20700864

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]01.20.2008 at 05:58AM PST, ID: 20701090

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01.20.2008 at 10:57AM PST, ID: 20702020

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01.26.2008 at 01:07AM PST, ID: 20748975

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: PostgreSQL Database
Tags: Postgres, Postgres, 8.2
Sign Up Now!
Solution Provided By: adrpo
Participating Experts: 3
Solution Grade: B
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628