Java

Moderators: zibadian
Number of threads: 7818
Number of posts: 18218

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
JDBC and RMI Posted by emon.kth on 1 Mar 2005 at 9:14 AM
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...

Report
Re: JDBC and RMI Posted by Jonathan on 4 Mar 2005 at 3:51 PM
: 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.");




 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.