File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Distributed Java and the fly likes how to connect  two servers using java. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Distributed Java
Bookmark "how to connect  two servers using java." Watch "how to connect  two servers using java." New topic

how to connect two servers using java.

vikas malviya

Joined: Aug 06, 2009
Posts: 14

i have to create an application in which two servers are two be connected.consider an example of login page in which all the details of login page are store in server1 and i have to store the data in another server i.e server2.....the main thing is thet both servers are in different locations.

server1 is in india and server2 is in US.

1.code for the connection of server1 to server2.

2. how to send data from server1 to server2.


Vikas Malviya
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13037
You have a lot of options with Java.

One of the simplest would be to HttpURLConnection - assuming both can handle HTTP connections.
Another alternative would be email.

Packaging the data for transmission could be as simple as emulating an Http form request with named parameters or as complex as an encrypted SOAP message.

What are your requirements for secrecy, security and authentication of the data? How large is the data likely to be.

Sachin Kumar

Joined: Aug 31, 2008
Posts: 20
your scenario is simple. It happens when keep static contrents on web servers and secured or business components on app servers where data is processed by app server. In your case you can achieve it through virtual directry mapping or including rthe login page data from server 1. Client application or user should always talk to server2 and you post data should go to server2.
I agree. Here's the link:
subject: how to connect two servers using java.
It's not a secret anymore!