Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners REPORT WITH JTABLE
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Golla Tejesh Yadav
REPORT WITH JTABLE
1 Answer(s)      3 years and 11 months ago
Posted in : Java Beginners


i have data in backend(oracle10g,spl+).i want the data into front end(java jdk) with the help of jtables thnx in advance


Advertisement
View Answers

January 10, 2011 at 10:59 AM


Hi Friend,

We have used MySQL database.Try this:

import java.io.*;
import java.awt.*;
import java.sql.*;
import java.util.*;
import javax.swing.*;

class JTableDatabase extends JFrame{
    ResultSet rs;
    JTableDatabase(){
    final Vector columnNames = new Vector();
        final Vector data = new Vector();
      JPanel panel=new JPanel();
      try{
    Class.forName("com.mysql.jdbc.Driver");
     Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/test", "root", "root");
        Statement st = con.createStatement();
        ResultSet rs= st.executeQuery("Select * from employee");
    ResultSetMetaData md = rs.getMetaData();
int columns = md.getColumnCount();
for (int i = 1; i <= columns; i++) {
columnNames.addElement( md.getColumnName(i) );
}
while (rs.next()) {
Vector row = new Vector(columns);
for (int i = 1; i <= columns; i++) {
row.addElement( rs.getObject(i) );
}
data.addElement( row );
}
}
catch(Exception e){}
JTable table = new JTable(data, columnNames);
JScrollPane scrollPane = new JScrollPane(table);
panel.add(scrollPane);
add(panel);
}
 public static void main(String arg[])
  {
    try
    {
    JTableDatabase frame=new JTableDatabase();
    frame.setSize(550,200);
    frame.setVisible(true);
    }
  catch(Exception e)
    {}
  }
}

Thanks



Related Tutorials/Questions & Answers:
REPORT WITH JTABLE
REPORT WITH JTABLE  i have data in backend(oracle10g,spl+).i want the data into front end(java jdk) with the help of jtables thnx in advance  ...(Exception e){} JTable table = new JTable(data, columnNames); JScrollPane scrollPane
report
report  how to take input from number of classes like order, bill,customer to another class say report to make a report on all these things
Advertisements
JTable
JTable  Values to be displayed in JTextfield when Clicked on JTable Cells
JTable
JTable   how to select a definite cell which containing a similar text containg to the one which the user entering from a jtable at runtime in java
JTable
JTable  i want to delete record from JTable using a MenuItem DELETE. and values of JTable are fetched from database....please reply soon
JTable
JTable  need to add values to a JTable having 4 coloumns ,2 of them are comboboxes
JTable
JTable  Hello, i cannot display data from my table in the database to the cells of my JTable. please help me
jtable
jtable  how to get the values from database into jtable and also add a checkbox into it and then when selected the checkbox it should again insert into database the selected chewckbox.plzz help
jtable
jtable  hi Sir i am working netbeans IDE,I have a jtable when i insert values in jtable then i am unable to print all inserted values,For eg if i insert 1,2,3,4,5,6,7,8 values then , i am getting output
jtable
jtable  hey i have build a form and i m also able to add data from database to jtable along with checkbox.the only problem is that if i select multiple checkboxes the data doesnt get inserted into new database and if only one
JTable
JTable  Hi I have problems in setting values to a cell in Jtable which is in a jFrame which implements TableModelListener which has a abstract method tableChanged(TableModelEvent e) . I'll be loading values from data base when
JTable
"}; JTable table=new JTable(data,labels); JScrollPane pane=new JScrollPane
jasper report - Java Beginners
jasper report  please tell me how to get report in jasperreport from jtable using netbeens
Report Genrating
Report Genrating  How can i genrate the report on java by using jdbc records in our application
report generation
report generation  i need to show the report between two dates in jsp is it possible
Report - JDBC
JSP Page show report on specific time interval  I want to display the report at the specific time from the data base in my JSP page
Opentap Report
Opentap Report  how to run in build report in oepntaps how to make analytics data base in opentaps
dynamic report
dynamic report  i need complete code for generating dynamic report in jsp
jasper report
jasper report  Sir, I have created report using ireport3 in netbeans but i am not able to show the report in jsp and also want to show the dynamicaly generated reports and aslo show in pdf and excel Please help Thanks
report generation
report generation  hi i need a code to generate reports in bar graph and pie charts.i found these codes in roseindia.in unfortunately its not working................. plz help me
report generation
report generation  hi i need a code to generate reports in bar graph and pie charts.i found these codes in roseindia.in unfortunately its not working................. plz help me
report problem
report problem  I have made a project that displays charts using jfreechart library from the student marks stored in a database. what all can i... such project report,then do soon,..Its urgent.   Please visit the following
report generation
report generation  hi i found some source codes related to barchart and pie chart .when i try to run thise code its showing me the error as :- java.lang.NoSuchMethodError: org.jfree.text.TextBlock.setLineAlignment(Lorg/jfree/ui
generate report
generate report  hai, im learning php so pls help me .... what is a coding for generate report by month using php... wat is a code php for create calender and listing from database... pls someone help me
generate report
generate report  hai, im learning php so pls help me .... what is a coding for generate report by month using php... wat is a code php for create calender and listing from database... pls someone help me
Birt Report
Birt Report  Help with birt reports in myeclipse. I'm getting an exception when trying to display the report. Can u give me the complete procedure and the code as well. The exception is: Cannot open the connection for the driver
generate report in swing
generate report in swing  generate report in swing
Generating report in java
Generating report in java  How can I generate a report in java
report generation using jsp
report generation using jsp  report generation coding using jsp
report generation - EJB
report generation   how to create the report in java
report making in asp
report making in asp  Hi sir, Please give some example report making code for jsp and mysql
Advertisements
 

 

 

DMCA.com