• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

issue in Jtable when populates value from oracle

 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
[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

here is my function


update function which calls this method is below
[/color]
gui.jpg
[Thumbnail for gui.jpg]
screen shot of gui
 
Sheriff
Posts: 28360
99
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


I don't see where you are declaring that variable "data". It's some type of collection, clearly, and I don't see any code which clears it before you start loading data into it from your ResultSet.
 
Azeem Rathore
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Paul Thanks for the reply here is my department_form code i am declaring data variable in form class

i already post the getall employees function above kindly help please i am still looking for the solution
thanks in advance
 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You need to add System.exit(0); after the line 89 in your code. Refer this link for the details https://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
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Just in main call the frame with out thread like
and see that solves the problem.
 
Azeem Rathore
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Grow a forest with seedballs and this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic