Using RMI to synchronize two databases

Hello
I have studied Java for some time, but never had
the opportunity to work in a "real project", but
now I have something to do...
I have the following situation: two offices
of a company, the central one running SQL Server
database and other running Oracle, must change
information, reading data from Oracle and saving in
SQLServer and vice-versa. The programs should be
running all day, checking at specified periods of
time if there is some information to be updated
in any database.
The offices are phisically far, so it should be
used Internet to make the connection (both sites
are connected to Internet 24h).
I was wondering on using the Java RMI technology
to achieve this. I have read the official Sun
documentation about RMI and some articles, and I
found it very interesting, and pretty easy to
implement.
But I have some "real world" questions:
- Is RMI the ideal solution for this problem, or
there is some newer or more adequate one?
- At first it would be a small amount of data
to be synchronized, but if it grows a lot or
more offices are to be connected, is RMI performance
good? (is it quick?)
- About security - is RMI secure? I mean, I think
the server program should be listening a port in a
IP address open to ALL the internet... How safe is
the user authentication, or this is responsability of
the application?
- What is the relationship between RMI and proxies,
firewalls etc? Are they compatible?
- XML is something to think about using for this
application, or it have nothing to do to the job?
The initial option was using a Microsoft solution
to make this application :(, but I would be very happy
if I could use Java ;) , but I have to have the
adequate technical base to suggest it...
So, any help would be very welcome!
Luis Cabral

Here's a set of (some) answers based on my experience (which is NOT synchronizing two databases, but on synchronizing sets of files across a tree of file servers.)
Hello
1. It sounds like two databases must be cross-synchronized. You didn't say what the platforms were, but if they are mixed, then java is a positive choice.
2. Java rmi is fine for doing this kind of work. However I can't give you any performance guarantees. You probably need to get some fine requirements and write some model programs.
3. YOU are responsible for security. RMI gives you connectability; you have to develop some kind of cross-authentication procedure as part of you application.
4. To work over the internet, you will have to develop some way through firewalls.
o If the two sites use "Virtual private networks", then both the security issue and the firewall issue are mostly solved for you.
o Otherwise, and maybe even with vpn, you will have to do a little bit of work to use fixed port numbers. (The way rmi works is that there is a listener at a fixed port which will let a remote program "look up" a local object; after that, communication takes place object-object over a randomly-assigned port.) It takes about a dozen lines of code to make this work.
5. I don't think XML has anything to do with this problem. It MAY help you if you have serious data conversion issues. I hear it's a pig.
Finally, an application item that may or may not be an issue: Two databases, two platforms == possible character set conversion problems.

Similar Messages

  • How to synchronize two database in ur java program

    Hi All
    How to synchronize two data base of mysql using java programing language?
    If somebody has any idea that will help me a lot.
    Thanks and regards
    Srikant

    Of corse I have an idea, but not good!
    If you know the database stucture then copy data from one to another.
    Open 2 connections: one to source and one to dest.
    And:
    String sql = "SELCET * from mytable1";// from source
    string sql2;
    Statement st1 = connSrc.createStatement();
    Statement st2 = connDest.createStatement();
    ResultSet rs = st1.executeQuerry(sql);
    while(rs.next()){
    sql2 = "INSERT INTO mytable1 ('field1', 'filed2') VALUES ("+
    "'"+rs.get(filed1")+"',"+
    "'"+rs.get(filed2')+"'"+
    st2.executeUpdate(sql2);
    // the destination was cleared before this: DELETE FROM mytable1 WHERE 1
    This is a mysql sample without processing the errors.
    Szabi

  • How to synchronize two database

    Hi All,
    I am using oracle 10R2 in solaris 10. I am trying one scenario, but unable to come with solution. please give your suggestion.
    In machine A, I have one database called DB1 and its up and running. Now I took cold backup and created the same database in another machine called
    machine B.
    Now the database are running in both machine A & B ( both are same at present).
    Now I am going to do some changes in machine A ( create tables, add rows, delete roes, add user, etc etc etc ), Now I want to apply those changes to
    machine B on daily basis.
    I dont want to do logical standby database, because i am going to use the machine B also ( i will open always).
    Any other way to do this ???? like export or apply logs ??
    I am not sure about this
    Kindly give your suggestion.
    Regards
    Kumar

    Use Oracle Streams for updating Both Sids
    Oracle Streams, a built-in feature of the Oracle database, is a data replication and integration feature. It provides a flexible infrastructure that meets a wide variety of information sharing needs. Oracle Streams enables the propagation of data, transactions and events in a data stream either within a database, or from one database to another. Click on the following links for further details on Oracle Streams
    see this link
    http://www.oracle.com/technetwork/database/features/data-integration/index.html

  • *Synchronize two oracle databases in single database*

    Hi Friends,
    Is it possible to synchronize two database in single database.
    Actually the scenario is, there will be single instance database with dataguard config...So this database will be used from two different locations/places .. the distance is around 1000 Km. If the user not able to log from second location because of network problem ... then seconday server ie datagaurd will become primary for the second location.
    Then both the databasses will work as PRIMARY database for the two different locations. Once the network issue resolve then we need to sync the database to single database ...
    Is there any solution for synchonize the database ...or any tool for this one....
    Thanks in advance
    Anil Pinto

    Hi,
    You are looking for a Bidirectional Replication.
    Golden Gate Bidirectional Replication
    http://vishaldesai.wordpress.com/2011/02/24/golden-gate-bidirectional-replication-oracle-to-oracle-example/
    Oracle Streams
    Oracle Bi-Directional Data Replication
    http://www.databasejournal.com/features/oracle/article.php/3596971/Oracle-Bi-Directional-Data-Replication.htm
    Regards,
    Levi Pereira

  • How can I use two database in an application?

    When I use two database like CloudscapeDB and TestDB in J2EE1.3.1, I always get some exceptions, which is unknow source about one of them.I am doing a CMP entity bean application. Can someone tell how to set up the environment and what is problem about the exceptions I met?
    Thanks.

    Hi,
    The basics for using the two databases is simple.
    For database configuration you have to provide the driver class name, url, schema name and password during the creation of the connection pools. So u can create a as many no. of connection pools as the no. of the databases.
    Hope it will work..

  • How to ...synchronization between two databases

    Hi,
    I want to set up automatic synchronization between two databases. For example, database DB1 and DB2 have table t1 and t2 with the same columns. If someone updates a record in table t1, I want automatically update the record in t2 or vice-versa.
    How can I make an automatic system like that?

    1) What is the business goal you're trying to satisfy? Failover, reporting, replication, geographic co-location, etc. each have their own set of technologies. Explaining what you're trying to accomplish from a business perspective will help us identify which technology (or technologies) to focus on.
    2) Are you synchronizing a single table? Or multiple tables? Or all the tables in a schema? Or all the tables in a database?
    3) Is there a stable network connection between the boxes?
    4) What version of Oracle do you have (10.2, 10.1, 9.2, 9.0.1, etc)? What edition (standard, express, enterprise, etc)?
    5) How quickly after a change has been made on DB1 does the change need to reflect on DB2?
    6) Am I correct in understanding that you want to be able to change the same row of data on either DB1 or DB2? So the replication needs to go in both directions?
    Justin

  • Actually in my project The middle tier was written using RMI.The Database i

    Actually in my project The middle tier was written using RMI.The Database interaction was defined in the middle
    tier itself.My problem is , the queries we post to the database should interact with XML Database which in turn should
    interact with the actual Relational Database from which the XML Database was built.
    Thanks in Advance

    Leave the phone alone and let it cool down.

  • Hi can anyone explain me how to  syncronize two database using jsp?

    Hi can anyone explain me how to syncronize two database using jsp?

    I thinking than you really need the jsp page for calling the java methods whith sincronize the database.You think wrong.
    You wrote a bad question.What was bad about it?
    You need a java method for sincronize the two databases using a jsp page.No you don't, see my answer.

  • Synchronize two postgres databases

    how would one synchronize two postgres databases?
    I would like to have local changes to my website reflect onto the same website hosted on the web.
    anyone have any experience doing this?
    thanks.

    Hi,
    You are looking for a Bidirectional Replication.
    Golden Gate Bidirectional Replication
    http://vishaldesai.wordpress.com/2011/02/24/golden-gate-bidirectional-replication-oracle-to-oracle-example/
    Oracle Streams
    Oracle Bi-Directional Data Replication
    http://www.databasejournal.com/features/oracle/article.php/3596971/Oracle-Bi-Directional-Data-Replication.htm
    Regards,
    Levi Pereira

  • Synchronization using RMI

    Hi... i implemented a weak reader writer problem using Sockets... andnow i am into the task of using RMI to solve a distributed reader writer porblem.... i know that RMi takes care of communication and threads as it creates a thread for eah independent client... i would like to know as to how i could synchronize the operations of the clients... ( the clients readers and writers will access a server object through RMI to read or write into a shared value respectively... this is the problem i am working on).... can i use the same old synchronize keyword in server side?... i thought i would make just the methods responsible for interfacing with the clients remote accessible and use these methods to internally trigger sychronized methods in the server to access the shared variable.. can this be done... any other approach is really welcome..i am open to suggestions... i was going through a message from some forum when someone suggested that Synchronize should not be used on the server side in RMI as it doesn't go well with the RMI architecture and we must develop some form of remote synchronizarion mechanism for the clients to synchronize themselves.. .is this true?

    Thanks for the reply...i just have one more doubt... some times after starting the rmiregistry, when i try to start the server that contains the implementation of the remote methods, i get the following error message..
    RW RMI Server Exception RemoteException occurred in server thread; nested except
    ion is:
    java.rmi.UnmarshalException: error unmarshalling arguments; nested excep
    tion is:
    java.lang.ClassNotFoundException: RWImplementation_Stub
    I have compiled all the files properly and i have generated the stub and skeleton correctly for sure using rmic... but still i get this error message. I have no idea of why i get this error message.... it says ClassNotFoundException.... RWImplementation_Stub... but the stub and skeleton files are present and i have counterchecked it.Please help me out with this.

  • How can I use two database in Dataset in SSRS?

    Hi,
    I am using one query to generate my SSRS report. In that query I am using subquery. Now I am pulling data from multiple tales.
    DB used in sub query is different than the rest of the tables DB.(So total I am using 2 DB(Database))
    So I see that in SSRS, I can connect query(In DataSet Properties) to one DATA_SOURCE only, how can I use other database which is I used in sub-query?
    I have to move this SSRS into PROD and I can't hard code that sub-query's DB name in my query.
    Please give me suggestion. Thanks!!
    Vicky

    In SSRS 2008 R2 you can use the Lookup function (http://technet.microsoft.com/en-us/library/ee210531.aspx ) and LookupSet function (http://technet.microsoft.com/en-us/library/ee240819.aspx
    Depending on your security set up, you can reference a table in a second database on the same server using a three part name:  database.schema.table.  This is more likely to work for you if you wrap your SQL command in a stored procedure.
    Russel Loski, MCT, MCSE Data Platform/Business Intelligence. Twitter: @sqlmovers; blog: www.sqlmovers.com

  • Creating BAM report using data of two database tables. Say "EmployeeTable" and "DepartmentTable

    I want to populate data from two database tables into a BAM report. I have created two data objects for the tables and want to create 3rd data object so that it can take the data from the other data objects automatically. Is there any such facility within BAM?

    Hi
    1. I am not sure if you have option to combine multiple DataObjects like that.
    2. For your scenario, on Database side itself, I would recommend Create a VIEW that joins these 2 Tables and pull the required Columns and add required conditions. Verify the VIEW has all the rows expected.
    3. Then create DataObject for this View. Once you have DataObject, create the Report.
    Thanks
    Ravi Jegga

  • Strange system hang using rmi

    Hi, I read for several hours now, but I can't find a hint what problem I'm experiencing. Perhaps someone has an idea?
    I have a small java application (jdk1.3.1_08) which starts a RMIRegistry, binds an object name. It then starts another java application in another jvm using Runtime.exec(...).
    Everything fine until here. The second application starts and works fine.
    BUT: Now I close app2 and start it again from app1. Basically everything works also this time. But there is a delay at startup from app2 which I cannot explain. App2 hangs for 10 secondes up to 70 seconds, between two debug outputs!!!
    Every little hint is appreciated!!
    Torsten.

    I think the hanging of app2 is not depending on what it actually does. But I try to explain some more, you're right:
    App1 is kind of a starter environment, a launch center for several applications. One of these applications is my app2. The reason for using rmi and the second jvm is that I now can use a System.exit(0) in app2 without killing the launch center (app1). When I start app2 standalone from command line without rmi, then it starts without the strange system hang.
    What does app2 do?
    App2 has a starting time of about 30 seconds (standalone) where several things are initialized. In detail, it is a Swing application using the oracle framework JClient for data binding of Swing components and the oracle framework BC4J for mapping to an oracle database. The system hang when started in the second jvm occurs in the startup process, but not at a specific point in the programm. This means: on PC1 it hangs everytime between the same two debug outputs, on PC2 (a bit faster) it hangs later in the code. Thats the reason why I think, there could be a rmi problem.
    What I did not mention yet: The launch center (app1) builds a kind of transfer object which is passed via rmi to app2 in the second jvm.
    Does this help to solve my problem? I really run out of ideas what to do...

  • Synchronize with database problem

    Hi,
    I'm using JSF ADF BC, I have two tables in database, I've added new field to each, I go back to jdeveloper, and right click on both entities and click on synchronize with database, select new field that I've created and everything works fine, then I go to view object and here is the problem, in first view object I can add newly created and synchronized field like supposed (mapped to column or sql), but in the second view no matter what I do it is alway created as transient, I've tried deleting and synchronizing couple of times, changing properties, going to view row impl, view.xml, but it's always the same problem. Please can anyone help, I don't want to create whole view from scratch, every association, view link etc.
    Thanks in advance,
    Tomislav

    Hi,
    on view object editor screen, put your cursor on "Attributes" (left side of the screen) then click "NEW" button (on the right side of the screen), then fill in Attribute Name, check the "Map to column or SQL", and fill in query column. You are done.

  • Synchronize two schemas automatically

    Hi,
    Is there any easy way to synchronize two schemas automatically?
    I have one slave schema in an Oracle 9i database, and the master in a different machine running Oracle 10g.
    The aim is to synchronize the slave schema with the changes (DML and DDL) made in the master automatically e.g. everynight.
    I have heard about the Oracle Change Management Pack, but I don't know if it can be asynchronous.
    Thanks.

    Possible using Streams.
    http://www.oracle.com/technology/products/dataint/htdocs/streams_fo.html

Maybe you are looking for

  • Extracting Purchase Order condition data

    Hi All, I have requirement where as i need to pull the purchase order condition data, but i haven't found any datasources regarding that, can somebody guide me how to pull that data to BW. thanks Neel

  • How to deploy EAR file in Tomcat?

    Is we can deploy ear file in tomcat? Normally we can deploy WAR file in tomcat webapps folder. When we run the tomat it will automatically extract the war file. But samethink I have tried EAR file. But it is not working. Is we can deploy EAR file or

  • When will Adobe Reader for Mobile Devices support 3D PDF files?

    When will Adobe Reader for Mobile Devices support 3D PDF files?

  • Item Codes-Automatic(urgent)

    Hi All, I want to define Item Code as Default i.e In SAP How we are getting the Default numbering for eg.1,2,3,4.........I want in the same way for the Item Code.IS IT POSSIBLE through Query based FMS or any other way?? Thanks in Advance. mona

  • SetSize problem!

    hi all Is there any reason for setSize doesn�t work? i dont why, its not working for me! :-( i have a class which extends JFrame and ihv added setSize(600,500) in constructor, juzt after super(title) ! someone please help me! thanks and regards sarat