Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Other Java > Java Databases
Java Databases Discussion specific to working with Java Databases. For other Java topics, please see related Java forums. For database discussions not specific to Java, please see the Database category.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Java Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old December 22nd, 2003, 06:12 PM
Registered User
Join Date: Dec 2003
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Second SELECT statement causes app to hang

I am writing a piece of software using Java that consists of a fairly simple GUI to access a database. The first time the gui is generated, it requests data from the database using a default SQL statement. This default statement just returns all the values for the first two columns of a specific table. There is JTextField included in the GUI to search the table for specific entries.
I am using an adapted version of an example from Beginning Java 2 (JDK 1.3 edition) pages 1042-1052. I have pratically copied the ResultsModel class word-for-word, the major differences are how I've implemented the GUI. I am still using a JTable to display the results, but I am using a Thread to retrieve the new results and update the table.

My problem is this: The first time the Thread accesses the database, the table is updated fine. Any subsequent attempt to display another ResultModel causes the program to hang. By careful placement of prinln() statements, I have worked out that it is the fireTableChanged() method that is actually responsible. The Thread seems to retrieve the new ResultSet and store it in the ResultsModel class, but when the fireTableChanged() method is called, it stops execution.

I am writing my code using NetBeans 3.5.1, running through SuSE Linux 8.1. The database is implemented in MySQL, and is stored on another machine, connected to my own using a cross-over cable. I cannot figure out why the JTable does not successfully update a second time, any suggestions would be most appreciated.

If you think posting my code would help, just let me know - I would have posted it now, but it's a bit messy at the moment!

Thank you in advance.

Peter Green.

Similar Threads
Thread Thread Starter Forum Replies Last Post
Select Statement jmss66 VB How-To 7 August 20th, 2008 04:02 PM
Select Statement gregalb SQL Server 2005 3 May 16th, 2008 08:51 AM
Select In Statement mr_pc1963 SQL Server 2005 2 April 19th, 2008 09:59 AM
Select statement.. help please sarah lee SQL Server 2000 4 May 16th, 2007 09:13 AM
Select from another select statement to a repeater simsen ASP.NET 2.0 Professional 0 May 2nd, 2007 04:34 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.