Java client on local machine update database on server

Java client on local machine update database on server

Post by Kieran Clinton Taresta » Thu, 13 Nov 2003 07:18:57



Hi,

I'm doing a project where I will have a java GUI on a clients machine and I
want it to have the ability to receive input from a user and then update a
postgresql database (but wouldn't have to be straight away). I can currently
think of two ways of doing this:

Firstly turn the user input to a set of SQL statements and save into a text
file and then create a transaction that will connect to the database on the
server and execute them all.

Probably an easier way would be to have a copy of the database on the
clients machine and copy the database to the server every night or so.

Would either of these ideas work? Which seems less crazy? Is there an easier
way?

Thanks in advance for the help. Apologies in advance for being such a
novice.

Kieran Tarestad

 
 
 

Java client on local machine update database on server

Post by Noe » Fri, 14 Nov 2003 10:11:06


Hi,


> Hi,

> I'm doing a project where I will have a java GUI on a clients machine
> and I want it to have the ability to receive input from a user and
> then update a postgresql database (but wouldn't have to be straight
> away). I can currently think of two ways of doing this:

> Firstly turn the user input to a set of SQL statements and save into a
> text file and then create a transaction that will connect to the
> database on the server and execute them all.

It would be best to do it stright away, which allows the database to
always reflect it's current state, using java rmi is a stright forward
way of doing it. http://www.java.sun.com/products/jdk/rmi/
Another option is to use a web interface and use PHP or perl to interact
with the database.

Quote:> Probably an easier way would be to have a copy of the database on the
> clients machine and copy the database to the server every night or so.

> Would either of these ideas work? Which seems less crazy? Is there an
> easier way?

You would need to run a replication tool to do that, such as postgres-r.
Which ensures that all client database are the same, ie syncronised.
Having the database replicated on client machines means that you will
have to set them up indervidually and if each client's OS is different,
which may be a pain. Simplest solution would be having the clients
connect directly to the database on the server.

Good luck

Noel