Results 1 to 2 of 2
  1. #1
    MonkeyMan is offline Member
    Join Date
    Jan 2012
    Posts
    45
    Rep Power
    0

    Default write stuff from jTable to mySQL table

    I got this jTable jazz in my project, I'm fetching stuff from a mySQL database and populating a bunch of jTables. Now I've found some examples how to use jTable events to track for cell changes and then update, but I'm looking for a less efficient but perhaps simpler to understand method of updating the database from the jTable data through a GUI button.

    If I could get an example how to grab all of the data, even the non-changed data, and write it all to an example database, that would be sweet!

    At this point I'm just unsure how do I go about getting everything from the jTable efficiently and as simply as possible :)

  2. #2
    doWhile is offline Moderator
    Join Date
    Jul 2010
    Location
    California
    Posts
    1,641
    Rep Power
    7

    Default Re: write stuff from jTable to mySQL table

    Quote Originally Posted by MonkeyMan View Post
    If I could get an example how to grab all of the data, even the non-changed data, and write it all to an example database, that would be sweet!

    At this point I'm just unsure how do I go about getting everything from the jTable efficiently and as simply as possible :)
    Doing so is highly dependent upon your data model, and did you try search the net for example? What have you tried? If you just want to load data using a JButton, then write an ActionListener and get the data from the JTable (the API clearly lists several methods for doing so - including getValueAt) then update your database as appropriate using JDBC. Otherwise, while the listener approach may seem difficult, it is much more maintainable and better practice.

Similar Threads

  1. insert to MySQL table
    By asai in forum New To Java
    Replies: 2
    Last Post: 02-19-2012, 01:56 PM
  2. Replies: 2
    Last Post: 05-09-2011, 06:55 PM
  3. Replies: 0
    Last Post: 02-21-2010, 11:51 AM
  4. Table, beginner stuff
    By drwk in forum New To Java
    Replies: 1
    Last Post: 01-24-2010, 07:19 PM
  5. Replies: 0
    Last Post: 03-29-2008, 03:36 PM

Posting Permissions

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