Results 1 to 7 of 7
  1. #1
    kevinn205 is offline Member
    Join Date
    Nov 2011
    Posts
    65
    Rep Power
    0

    Default Connecting Classes On 2 Computers Question Jtable

    Hey, Thank you for taking the time to read my question! I set up a jtable and a seperate adding class.
    I then added a action listener to the jtable so that it would be informed whenever I made a change to it.
    It works sucessfully when performed on the same computer, however; whenever I try it from a remote computer it is not aware that the change has been made.
    The program works when I use it on the other computer it is just not aware the the data was added and has to be manually refreshed.

    I was wondering what I should use to get this to work? Is connectiong pooling at all on the right track, or how do I get it to know that another computer has made a change?

    --I just looked up some more information on java and noticed that I set up a connection to mysql from each program, however, I never set up any connection between the computer or servers, I hope this helps !

    Thank you for any imput or insight!
    Last edited by kevinn205; 12-12-2011 at 09:18 PM.

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    16,544
    Rep Power
    23

    Default Re: Connecting Classes On 2 Computers Question Jtable

    How do you expect the data on one computer to be seen by a program on another computer?
    What is the communication channnel between them
    or where is the common place that they can both see?

  3. #3
    kevinn205 is offline Member
    Join Date
    Nov 2011
    Posts
    65
    Rep Power
    0

    Default Re: Connecting Classes On 2 Computers Question Jtable

    My exact thought :/ It's certainly possible though right? Would it involve networking using tcpip? know of any starting place?

    currently they both send data to mysql that they can both read, but i made it so i have a refresh button or as they add the data they refresh it, I'm assuming i need to do more work on the way that it refreshes data when it adds it

    perhaps some kind of connection to all devices on the network that have the jtable program open?
    Last edited by kevinn205; 12-12-2011 at 10:18 PM.

  4. #4
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    16,544
    Rep Power
    23

    Default Re: Connecting Classes On 2 Computers Question Jtable

    Sorry, I have no experience with databases on a network.

  5. #5
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    16,544
    Rep Power
    23

    Default Re: Connecting Classes On 2 Computers Question Jtable

    You should get some traffic here.

  6. #6
    doWhile is offline Moderator
    Join Date
    Jul 2010
    Location
    California
    Posts
    1,642
    Rep Power
    6

    Default Re: Connecting Classes On 2 Computers Question Jtable

    There are many ways to do this, but none that come to mind are trivial. Most solutions I can think of involve a central application server that is notified when a Client launches/closes (so it knows whom to notify). When an update occurs (either through the server application itself using RMI or Networking, or via a trigger in the database) the app server then notifies all listening clients of the change, again through RMI or a socket. The following links are tutorials that delve into the nitty gritty
    Lesson: All About Sockets (The Java™ Tutorials > Custom Networking)
    Trail: RMI (The Java™ Tutorials)

  7. #7
    kevinn205 is offline Member
    Join Date
    Nov 2011
    Posts
    65
    Rep Power
    0

    Default Re: Connecting Classes On 2 Computers Question Jtable

    Thank you very much! that was what i was looking for,

    so it is best to connect all of the computers to my server which is running mysql but use a mysql and a networking connection. I will need to set up a listener to know that one computer has made a change then notify all other computers of the change.

    If anyone reads this do you think static vs dynamic ips will be alot different (dynamic might be harder?)
    and i think ill start with socket since i already have created client server softare in it :D ( any significant reason not to?)

Similar Threads

  1. java question on classes & objects
    By joe98 in forum New To Java
    Replies: 16
    Last Post: 04-08-2011, 09:45 AM
  2. Jtable gives error when connecting to mySQL
    By Mv.c9 in forum NetBeans
    Replies: 0
    Last Post: 03-07-2011, 05:11 PM
  3. question about abstract classes
    By TheFlying_Boy in forum New To Java
    Replies: 6
    Last Post: 07-08-2009, 07:19 AM
  4. Replies: 0
    Last Post: 12-24-2008, 10:35 AM
  5. Replies: 0
    Last Post: 12-16-2008, 08:32 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •