Home > Archive > SQL Server JDBC > June 2005 > java replication app









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author java replication app
inder

2005-05-26, 3:23 am

Hi all,

I'm trying to develop a Java application that will manipulate and
transfer data from sql server X to sql server Y (transactional replication
is not an option). I'm pretty new to this sort of thing, but how can my
Java application be notified when a record is updated/inserted into X so
that it can be stored in Y? Does Java have some kind of event-driven api
for this sort of thing?

Many thank in advance,
Inder
Frank Brouwer

2005-05-27, 11:23 am

Hi,

If you can not use triggers to "copy" the data the next best thing to do is
create a "polling" (put it in a separate thread) mechanism that checks the
database for performed actions (like the update/insert) and take appropriate
steps to write into database Y.

Regards,

Frank.


"inder" <inderjitrai@yahoo.com> wrote in message
news:Xns96626FEC2695
inderjitraiyahoocom@
216.196.97.142...
> Hi all,
>
> I'm trying to develop a Java application that will manipulate and
> transfer data from sql server X to sql server Y (transactional replication
> is not an option). I'm pretty new to this sort of thing, but how can my
> Java application be notified when a record is updated/inserted into X so
> that it can be stored in Y? Does Java have some kind of event-driven api
> for this sort of thing?
>
> Many thank in advance,
> Inder



Alin Sinpalean

2005-05-27, 11:23 am

> Does Java have some kind of event-driven api for this sort of thing?

No it doesn't. Neither does any other programming language/database
access library. Databases aren't supposed to do that.

You could conceivably write a trigger that notifies an external
app/library that a row has been updated/inserted, but you don't want
that either. It will mean a lot of overhead and it will most probably
noticeably affect the performance of insert/update operations. Do you
think it's worth it?

Instead you could just poll the table you're interested in and see if
anything has been added/modified; a trigger to update a timestamp would
be quite enough then.

Alin,
The jTDS Project.

Inderjit Rai

2005-05-27, 8:23 pm

Hi Frank,

The problem is that i'm not allowed to modify any of the databases
(i.e. add triggers, sp's) because of the licence agreement, also the two
databases will be different SQL Server's on the same Windows Server
2003. How do poll a database using a Java app? Are there any good
books/online tutorials where i can get started?

Thanks again,

Inder



*** Sent via Developersdex http://www.droptable.com ***
Frank Brouwer

2005-06-01, 3:23 am

Hi Inder,

I hope this does not mean that you are not allowed to create a new SP or
trigger, otherwise you will have to use Java to do the copying of the
database between the databases.

The basics for a very simple mechanism is to create a Class with a method to
access the database (and do the check stuff) then use a separate Thread to
run this method and when the method completes let it sleep for a time and
start all over again. You can add any functionality to make it better,
nicer etc. as you feel like it.

For online reading just type <java polling> into a search machine, you will
find many items about it.

regards,

Frank.



"Inderjit Rai" <inderjitrai@rogers.com> wrote in message
news:u87xMzwYFHA.252@TK2MSFTNGP12.phx.gbl...
> Hi Frank,
>
> The problem is that i'm not allowed to modify any of the databases
> (i.e. add triggers, sp's) because of the licence agreement, also the two
> databases will be different SQL Server's on the same Windows Server
> 2003. How do poll a database using a Java app? Are there any good
> books/online tutorials where i can get started?
>
> Thanks again,
>
> Inder
>
>
>
> *** Sent via Developersdex http://www.droptable.com ***



Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2009 droptable.com