issue in Jtable when populates value from oracle

[color=darkred]Hi i am new to java programming and using oracle in back end and i have table hr_departments which contain 14 column
i have made function in java which retrieves three column dep_code,dep_name, dep_short_name in department class
and in form class in the form i have jtable which dynamically fill the jtable from database i have made update_table function and call in constructor so that when ever the form load it filled the jtable populates automatically from the database values
now issue is this i had 11 records in the database table it loads in the jtable correctly . i empty table values from database and load again it shows my same 11 records in my jtable . i create another database with different name and insert 3 records it populates three records then later i empty that database too it still showing three records and all the values in the jtable i check on database count row it shows zero even i set joption pane to display number to rows it display correct answer but jtable is not updating once it is populated.please tell me what is the issue . Alaso the images i upload

When you are saying that you are loading again , Are you referring to close the window and opening again?.I am not seeing the connection close statement.Also did you got the chance to see that the Update_Table is getting executed when you are loading the program again.

Azeem Rathore
Ranch Hand

Joined: Jun 26, 2013
Posts: 30

posted Jun 26, 2013 16:27:29

0

yes loading again is i close the program and then run it again .
hmm i do not understand how to check Update_Table is getting executed or not i am only in 2nd semester of my Bachelors and new to programming can you please help me how to fix it ?
how and where to close the statement? i didnt close any connection .
Thanks ganesh

Ganesh Malaichamy
Greenhorn

Joined: Feb 11, 2011
Posts: 27

posted Jun 26, 2013 16:42:47

0

You need to add System.exit(0); after the line 89 in your code. Refer this link for the details http://www.coderanch.com/t/346186/GUI/java/InvokeLater. Adding System.exit might solve the problem but that is not the clean solution. You need to add frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE) for the frames you are adding. From the code it seems like the resources are not released properly.For the simpler debugging you can add System.out.println statement inside the methods.This will get displayed during the program execution in the console. You can set the break point and debug the program.

Azeem Rathore
Ranch Hand

Joined: Jun 26, 2013
Posts: 30

posted Jun 26, 2013 17:01:14

0

I added System.exit(0); after line 89 when i run the program frame open and suddenly close like just glimpse of the frame

Ganesh Malaichamy
Greenhorn

Joined: Feb 11, 2011
Posts: 27

posted Jun 26, 2013 17:07:12

0

Just in main call the frame with out thread like
and see that solves the problem.

Azeem Rathore
Ranch Hand

Joined: Jun 26, 2013
Posts: 30

posted Jun 26, 2013 17:17:46

0

i went to the netbeans databases and there i connect database and went to hrm netbeans showing 11 records in my table but oracle showing no record now i understand it is getting data from the netbean database
can you tell me why?
i hope you understand my english my first language is german so bear with me

Azeem Rathore
Ranch Hand

Joined: Jun 26, 2013
Posts: 30

posted Jun 26, 2013 17:20:13

0

i mean to say when i view record from toad for oracle and connect database and view the tables it does not show any record but in the netbeans >services> databases> and connect oracle it shows my schema called hrm when i click on that hrm it shows my tables and in my table there is data 11 records
am i connected to correct database? kindly tell me please

Ganesh Malaichamy
Greenhorn

Joined: Feb 11, 2011
Posts: 27

posted Jun 26, 2013 22:04:52

0

Check the connection settings (ServerName,schemaName) from both the TOAD and the NetBeans. Try to insert the same data from both the end and see both are reflecting the changes.