Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

JDBC and RMI

emon.kthemon.kth Posts: 2Member
i'm developing a client-server based database application...the application is like this:
i have two locations A and B and they are connected through internet...i want to setup a database server at location A and a client database at location B...i will take some user information through a form at location B...that information will be inserted in the database at location B...the same information should also be stored at a database at location A...i'm developing this application using java and MYSQL...my question is do i need to write some RMI code to transfer data from location B to location A or the JDBC takes care of that itself???if you guys can help out then it would be great...

Comments

  • JonathanJonathan Posts: 2,914Member
    : i'm developing a client-server based database application...the application is like this:
    : i have two locations A and B and they are connected through internet...i want to setup a database server at location A and a client database at location B...i will take some user information through a form at location B...that information will be inserted in the database at location B...the same information should also be stored at a database at location A...i'm developing this application using java and MYSQL...my question is do i need to write some RMI code to transfer data from location B to location A or the JDBC takes care of that itself???if you guys can help out then it would be great...
    :
    It's possible to connect to a remote MySQL server in every MySQL database connectivity system I've ever used, so I'm quite certain that the JDBC will handle it. Just specify the host name when you connect to the database. You'll need to do the queries on both of them, but I'm sure you can define a class that lets you query multiple DBs and write the code like you were only querying one. It makes transactional stuff more fun though, because you have to consider the case where the query suceeds on one database and fails on another. Unless all queries are idempotent (unlikely) and you can promise an ordering that presists between server and client (acquire table locks on A and B, then do the ops, then release them). Of course, you may not need that for what you're doing.

    On the other hand, using RMI and having a remote JAVA application doing the insertion would allow you to do more advanced validation on the data being inserted into the database at location A. If the db at A is a "master copy" or something and you want to make sure an evil client doesn't hash stuff up, then RMI could be helpful. Again, there's the "what if one machine fails" and "what if other operations are going on" issues - it seems to me that doing replication really reliably can involve dealing with some quite subtle issues. How much you have to care about these depends on whether you're doing a project at college or building a system for a multi-million dollar corporation. :-)

    Hope this helps,

    Jonathan

    ###
    for(74,117,115,116){$::a.=chr};(($_.='qwertyui')&&
    (tr/yuiqwert/her anot/))for($::b);for($::c){$_.=$^X;
    /(p.{2}l)/;$_=$1}$::b=~/(..)$/;print("$::a$::b $::c hack$1.");

Sign In or Register to comment.