File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes Table data does not appear after inserting it to the JTable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Table data does not appear after inserting it to the JTable" Watch "Table data does not appear after inserting it to the JTable" New topic
Author

Table data does not appear after inserting it to the JTable

Bobby Johnson
Greenhorn

Joined: Jan 05, 2009
Posts: 3
Good morning, everyone. I am having a problem displaying the data in the JTable once I have inserted the values into the database. After I press the submit button, only blank rows are inserted into the JTable. It seems the insert functionality is working but the problem is it is not displaying the data like it should. I am inserting data from JTextfields from a JDialog panel and the data should be displayed in the JTable of the main view of my software application. Here is the SQL Insert Query that will insert the values into the database and then be displayed in the JTable:


Here is the method which will be called upon once the submit button is clicked:


Here is the class that performs the insertion into the database:



Finally, here is the database code for the main view:


Could anybody help me with this problem? Any suggestions would be appreciate. Thank you and have a great day.
[edit]Insert newlines and // and "+" to break long lines going over edge of screen. CR[/edit]
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 36468
    
  16
Please add a line which prints the text of the query as you call the insert query, probably in the insert method you quoted.
Please print the appropriate table before and after, using the command-line to access the database rather than JDBC. That might help you see what is going on.
How are you setting up your query String? The code you commented out doesn't look as if it would work. It is worthwhile learning about the format method of the String class, which might enable you to create such a String more easily.
 
jQuery in Action, 2nd edition
 
subject: Table data does not appear after inserting it to the JTable
 
Similar Threads
Print in the printer a result of JTable?
Displaying JRadiobuttons with Jtable dynamically.
jsp and jdbc
Help: Connecting MySQL Database to JTable
Need help in Connecting my MySQL Database to JTable in Eclipse.