Re: Send a command to postgres and close the program
От | Craig Ringer |
---|---|
Тема | Re: Send a command to postgres and close the program |
Дата | |
Msg-id | 4C8C2AC9.2080407@postnewspapers.com.au обсуждение исходный текст |
Ответ на | Re: Send a command to postgres and close the program (Thiago Godoi <thiagogodoi10@gmail.com>) |
Список | pgsql-jdbc |
On 09/11/2010 11:04 AM, Thiago Godoi wrote: > The long-running work will be a command without data transfer to the > server , that needs to continue processing the command after the client > close the conection/program . > > This function of send a command to the server is for apply correction > patchs in the database. OK, so you almost certainly want to do this server-side. Create a queue table, and have your client insert the required information into the queue table. Create a trigger on the queue table that fires a NOTIFY when something is inserted into it. Write a server-side script/program that maintains a connection to the database and LISTENs to the message your queue table NOTIFY will send. When the server side program receives a NOTIFY, it should read the queue table and start the required long-running processing for each entry it finds. Since you're using Java on the client side you'll probably want to write a simple command-line J2SE app for the server-side part. All it has to do is eastablish a JDBC connection, obtain the PGConnection from it, and loop checking for notifications. Launch it as a daemon/service on your server and you're set. -- Craig Ringer
В списке pgsql-jdbc по дате отправления: