• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Remote & Local mode connection

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear, all-members !
My package structure is as follows;
suncertify : 1. db ; Data.java,
DataInfo.java,
FieldInfo.java,
DatabaseException.java,
db.db
2. server ; DataServer.java(Interface),
Server.java,
ServerImpl.java
3. client ; DataClient.java(Interface),
DataClientGUI.java,
LocalDataClient.java,
RemoteClient.java
TableModel.java
To get a remote & local instance at GUI,
I intend to use following code snippet.
========================================
Data data;
if (local)
data = new LocalDataClient();
else
data = (ServerImpl) Name.lookup(bla bla)
========================================
Can anyone suggest a graceful way to implement it ?
Thanks in advance.
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It looks like it is a good implementation. If I had a suggestion to what you might be asking, I'd say put that code into a DataAccessFactory class, that the client main class calls with the necessay parameters.
Mark
 
SungChan Park
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks, Mark Spritzler.
It seems that a graceful way to get a instance.
I'll try in that way.
Thanks you very much !
 
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Mark,
In the following code snippet.
========================================
Data data;
if (local)
data = new LocalDataClient();
else
data = (ServerImpl) Name.lookup(bla bla)
========================================
Does the rmi server not have to be up and running for the else to work ?
In other words what happens in the following secnario :-
The above client is in local mode and gets the local data connection.
Some other remote client can also connect because the server is up and running.
So would we not have two diffent connections to the database with their own Data objects and hence locking mechanism etc..
Please correct me if i am completely off beat here.
I did search the forum for this ,but still i am not very clear on this topic.
Thanks in advance.
Regards
Suchak Jani
 
Mark Spritzler
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you are in local mode, no other "Client" from somewhere else can use the db.db file, local or remote.
In local mode there is no server.
Mark
 
Suchak Jani
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Mark,
In other words i would have three scripts.
1. Start Server Remote
2. Start Client Remote(depends on 1)
3. Start Client Local (independant)
Does the above look Ok.
Regards
Suchak Jani
 
Mark Spritzler
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, exactly.
Mark
 
Suchak Jani
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I guess now i can change my design.
Thanks Mark
 
So I left, I came home, and I ate some pie. And then I read this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic