Displaying the table using TableModel

Hi,
I am using TableModel to connect to a database and display the results. I am unable to display the table. It doesn't display anything. Below is the code from the TableModel I am using to connect to database. Could anyone help me find the errors please. any help would be ggreatly appreciated.
public HolidayTableModel() throws ClassNotFoundException, SQLException
         tableData = new Vector();
         int currentRow = 0;  
        try
             Class.forName("oracle.jdbc.driver.OracleDriver");
             Connection con = DriverManager.getConnection("jdbc:odbc:thin:@rub:1521:1B","asd","asdf");                                   System.out.println("Connection Established...");
            sqlStatement = con.createStatement();
            ResultSet rs = sqlStatement.executeQuery("select * from hlday10t");                                      System.out.println("ResultSet Statement executed...");
            numCols = rs.getMetaData().getColumnCount();
            columnNames = new String[numCols]; //Get the column names and cache them                                      for(int column = 0; column<numCols; column++)
                 columnNames[column] = rs.getMetaData().getColumnLabel(column+1);
              while (rs.next())
                 Vector rowVector = new Vector();
                 for (int currentCol = 1; currentCol < numCols; currentCol++)
                     rowVector.addElement(rs.getObject(currentCol));
                 tableData.addElement(rowVector);
                 con.close();
                fireTableChanged(null);//Tell the listener a new table has arrived
        catch(ClassNotFoundException e){
              System.out.println("*** Cannot find database driver classes: "+e.getMessage());                                                            
         catch(SQLException e) {
             System.out.println("*** Cannot connect to this database: "+e.getMessage());                               } 

Hi,
My TableModel extends AbstractTabelModel. Here is the full code. Sorry for posting partial code before.
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.*;
import java.util.StringTokenizer;
import java.util.Vector;
import javax.swing.table.AbstractTableModel;
import java.util.*;
import java.text.*;
import java.sql.*;
import java.net.*;
import java.util.Properties;
import java.applet.Applet;
import oracle.jdbc.driver.*;
public class HolidayTableModel extends AbstractTableModel {
     int rows = 0;
     Vector data = new Vector();
        String[] columnNames = {"HOLIDAY_CODE",
                         "HOLIDAY_DESCR",
                         "HOLIDAY_DATE",
                         "LAST_CHANGE_USERID",
                         "LAST_CHANGE_TMSTMP"};
        Connection con;
        Statement sqlStatement;
        int numCols = 0;
        int numRows = 0;
        Vector tableData;
        public HolidayTableModel() throws ClassNotFoundException, SQLException
           tableData = new Vector();
           int currentRow = 0;
           try
              Class.forName("oracle.jdbc.driver.OracleDriver");
              Connection con = DriverManager.getConnection("jdbc:odbc:thin:@d1b:1521:1B","asdf","asdf");
              System.out.println("Connection Established...");
              sqlStatement = con.createStatement();
              ResultSet rs = sqlStatement.executeQuery("select * from hlday10t");
              System.out.println("ResultSet Statement executed...");
              numCols = rs.getMetaData().getColumnCount();
              columnNames = new String[numCols];
              //Get the column names and cache them
              for(int column = 0; column<numCols; column++)
                 columnNames[column] = rs.getMetaData().getColumnLabel(column+1);
              while (rs.next())
                 Vector rowVector = new Vector();
                 for (int currentCol = 1; currentCol < numCols; currentCol++)
                    rowVector.addElement(rs.getObject(currentCol));
                 tableData.addElement(rowVector);
                 con.close();
                 fireTableChanged(null);//Tell the listener a new table has arrived
           catch(ClassNotFoundException e){
               System.out.println("*** Cannot find database driver classes: "+e.getMessage());
           catch(SQLException e) {
                System.out.println("*** Cannot connect to this database: "+e.getMessage());
     public int getRowCount() {
          return tableData.size();
       public int getColumnCount() {
            return columnNames.length;
       public String getColumnName(int index) {
            return columnNames[index];
       public Object getValueAt(int row, int column)
           Vector rowVector = (Vector)tableData.elementAt(row);
           return (String)rowVector.elementAt(column);
     public void addRow(Vector rowData) {
          tableData.addElement(rowData);
          fireTableRowsInserted(tableData.size(), tableData.size() );
       public void removeRow(int row)
          data.removeElementAt(row);
          fireTableDataChanged();
       public boolean isCellEditable(int row, int column) {
          return true;
     public void setValueAt(Object o, int row, int column)
          // change a field of hi
          HolidayItem hi = (HolidayItem)data.elementAt(row);
          switch (column) {
               case 4:
                    hi.hlday_code = (String)o;
                    break;
               default:
                    System.out.println("Bad column when editing data: "+column);
                    break;
          fireTableCellUpdated(row, column);
}

Similar Messages

  • What r all the tables used for this report. please reply

    hai,
    what r all the tables used for this report.
    report :
    <b>
    •     Report to display all finished goods that go out-of-stock. Developed a drill down report for materials details (totals and subtotals for material stock values by material group and material type).</b>
    thanks in advance

    hi Ashok,
    Check this out
    http://www.allsaplinks.com/tables.html
    http://www.sapgenie.com/abap/tables.htm
    Regards,
    Santosh

  • What are all the tables used for this report ? please reply

    hai
    i have practcing reports,
    so any one give me the name of the tables used for the below report
    <b>Created report for invoice details, shipping details and partner function.</b>
    thanks in advance.
    by
    ashok

    Hi Ashok,
      I am sending you the code which will display tables present in SAP with the description and jump to datadic or SE16 by selecting plus F2 or F8.
    REPORT ZZBGS044 MESSAGE-ID Z1 LINE-COUNT 65 LINE-SIZE 132
                    NO STANDARD PAGE HEADING.
    Description: This program list all tables in        regards to the   *
                 selection criteria.                                     *
    Customizing: You need not to make any customizing to use this program*
    Change of    You only have to check that tables, functions and       *
    release:     includes till exists. Bedst just to check and run the   *
                 program.                                                *
    Programmer:  Benny G. Sørensen                                       *
    Date:        July 1995                                               *
    SAP R/3      2.2F                                                    *
    Corrections----
    Date        Userid     Correction                                    *
    xx-xx-xxxx  xxxxxxxxx  xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx *
    TABLES: DD02V                "SAP tables view
    DATA: BEGIN OF DYNTAB OCCURS 2000.
            INCLUDE STRUCTURE BDCDATA.
    DATA: END OF DYNTAB.
    DATA: BEGIN OF TABLES OCCURS 100.
            INCLUDE STRUCTURE DD02V.
    DATA: END OF TABLES.
    DATA: L        TYPE I,
          REPL(30) TYPE C VALUE '????????????????????????????'.
    FIELD-SYMBOLS:
    PARAMETERS:
    TABLE(30) TYPE C,
    TITLE(74) TYPE C LOWER CASE DEFAULT ' ',
    DOWNLOAD(1) TYPE C DEFAULT ' ',
    FILENAME(65) TYPE C DEFAULT 'c:SAPDOC?',
    EXCEPT(30) TYPE C DEFAULT ' '.
    START-OF-SELECTION.
    IF TABLE = ''.
    TABLE = '*' .
    ENDIF.
    IF TITLE = ''.
    TITLE = '*' .
    ENDIF.
    TRANSLATE TABLE USING '*%'.
    TRANSLATE TITLE USING '*%'.
    CONDENSE EXCEPT NO-GAPS.
    L = STRLEN( EXCEPT ).
    IF L > 0.
    ASSIGN REPL(L) TO
    ENDIF.
    SELECT * FROM DD02V INTO TABLES
    WHERE DDLANGUAGE = SY-LANGU
    AND TABNAME LIKE TABLE
    AND DDTEXT LIKE TITLE.
    HIDE DD02V-TABNAME.
    IF EXCEPT NE ''.
    REPLACE EXCEPT LENGTH L WITH
    INTO TABLES-TABNAME.
    ENDIF.
    TRANSLATE TABLE USING '% '.
    CONDENSE TABLE NO-GAPS.
    IF TABLES-TABNAME CS TABLE.
    WRITE:/ TABLES-TABNAME, ' ', TABLES-DDTEXT.
    APPEND TABLES.
    ENDIF.
    ENDSELECT.
    IF DOWNLOAD NE ''.
    CALL FUNCTION 'WS_DOWNLOAD'
    EXPORTING
    FILENAME = FILENAME
    FILETYPE = 'WK1' "ASC, WK1, DBF, DAT, bin
    TABLES
    DATA_TAB = TABLES.
    ENDIF.
    AT LINE-SELECTION.
    SET PARAMETER ID 'DOB' FIELD SY-LISEL(30) .
    CALL TRANSACTION 'SE12' AND SKIP FIRST SCREEN.
    AT PF8.
    CHECK SY-LISEL <>
      SET PARAMETER ID 'DTB' FIELD SY-LISEL(10) .
      REFRESH  DYNTAB.
      PERFORM DYNPRO USING:
         'X'  'SAPMSTAZ'     '0100'        "Selection screen
        ,' '  'DD02V-TABNAME'  SY-LISEL(10).
      CALL TRANSACTION 'SE16' USING DYNTAB MODE 'A' .
    FORM DYNPRO USING DYNBEGIN NAME VALUE.
      IF DYNBEGIN = 'X'.
        CLEAR DYNTAB.
        MOVE :  NAME TO DYNTAB-PROGRAM,
                VALUE TO DYNTAB-DYNPRO,
                DYNBEGIN TO DYNTAB-DYNBEGIN.
        APPEND DYNTAB.
      ELSE.
        CLEAR DYNTAB.
        MOVE:  NAME TO DYNTAB-FNAM,
               VALUE TO DYNTAB-FVAL.
        APPEND DYNTAB.
      ENDIF.
    ENDFORM.
    Regards,
    Azaz Ali.

  • What r the tables used for this report.

    hi all..
    i am a fresher for ABAP. i need the help.
    what r the tables used for this report.
    Reports provide pending order details according to Material wise and customer wise for particular month.
    thanks in advance
    RK.Ashokkumar.

    Hi Ashok,
    this is easy to do.
    Open Two SAP Screen with same user ID.
    Run SQL trace using ST05 transaction.Open ST05 transaction in One and make
    Trace on ,Run the report in another screen.
    Once report run is over.End the trace process and click on display trace in same ST05 transaction.There is a click button on ST05 Transaction screen to start trace
    process,End trace process and Display track process.
    The SQL trace will  give you all the table details which is used in that particular report.
    You have not mentioned about the report name so I have suggested this way.
    regards,nishant
    Please reward if this helps

  • What r all the tables  used for the following report

    hai
    what r all the tables  used for the following report
    report:
    <b>
    •     Report that displays all the late shipments in a particular period of time</b>
    send important fields for this tables also
    thanks in advance.

    Hi,
       Imp table are vttk,vttp,vtts.
    Regards
    Amole

  • Performance issue with the table use vrkpa

    Hi.
    here is the selection criteria that i am using and the table use vrkpa i only used to map the table kna1 and vbrk.vbrk and kna1 doesnot have the direct primary key relationship.
    please check and let me know wht this vrkpa is taking time and how can i improve the performance as from kna1,i am fetching data very easily while fetching nothing from vrkpa and fetching fkdat from vbrk.
    the idea behind using these tables is just for one kunnr (from kna1)getting the relevant entries based on the fkdat(selection screen input field),please suggest.
        SELECT kunnr
               name1
               land1
               regio
               ktokd
               FROM kna1
               INTO TABLE it_kna1
               FOR ALL ENTRIES IN it_knb1
               WHERE kunnr = it_knb1-kunnr
               AND ktokd = '0003'.
        IF sy-subrc = 0.
          SORT it_kna1 BY kunnr.
          DELETE ADJACENT DUPLICATES FROM it_kna1 COMPARING kunnr.
        ENDIF.
      ENDIF.
      IF NOT it_kna1[] IS INITIAL.
        SELECT kunnr
               vbeln
               FROM vrkpa
               INTO TABLE it_vrkpa
               FOR ALL ENTRIES IN it_kna1
               WHERE kunnr = it_kna1-kunnr.
        IF sy-subrc = 0.
          SORT it_vrkpa BY kunnr vbeln.
        ENDIF.
      ENDIF.
      IF NOT it_vrkpa[] IS INITIAL.
        SELECT vbeln
               kunrg
               fkdat
              kkber
               bukrs
               FROM vbrk
               INTO TABLE it_vbrk
               FOR ALL ENTRIES IN it_vrkpa
               WHERE vbeln = it_vrkpa-vbeln.
        IF sy-subrc = 0.
          DELETE it_vbrk WHERE fkdat NOT IN s_indate.
          DELETE it_vbrk WHERE fkdat NOT IN s_chdate.
          DELETE it_vbrk WHERE bukrs NOT IN s_ccode.
          SORT it_vbrk DESCENDING BY vbeln fkdat.
        ENDIF.
      ENDIF.

    Hi,
    Transaction SE11
    Table VRKPA => Display (not Change)
    Click on "Indexes"
    Click on "Create" (if your system is Basis 7.00, then click on the "Create" drop-down icon and choose "Create extension index")
    Choose a name (up to 3 characterss, start with Z)
    Enter a description for the index
    Enter the field names of the index
    Choose "Save" (prompts for transport request)
    Choose "Activate"
    If after "Activate' the status shows "Index exists in database system <...>", then you have nothing more to dotable is very large the activation will not create the index in the database and the status remains "Index does nor exist". In that case:
    - Transaction SE14
    - Table VRKPA -> Edit
    - Choose "Indexes" and select your new index
    - Choose "Create database index"; mark the option "Background"
    - Wait until the job is finished and check in SE11 that the index now exists in the DB
    You don't have to do anyhting to your program because Oracle should choose the new index automatically. Run a SQL Trace to make sure.
    Rgds,
    Mark

  • Can I display the table content of a web page??

    Hi guys I am new to java and here I need to count the words in each table and display the table with largest number of words . This being a part of my huge project. Below is my code where I have succeeded in displaying all the tables present in the web page.But I need to count all the words in the table and display only that table which has largest number of words including all the tags. So java experts please help me with this piece of code...................
    import java.net.*;
    import java.io.*;
    import java.util.*;
    import java.util.regex.*;
    public class findtable{
      public static void main(String[] args) {
        String inputLine = null;
        String wholeHtml = "";
    int trcount=0;
        try{
          URL yahoo = new URL("http://books.google.com/books?q=+subject:%22+Science+Fiction+%22&as_brr=3&rview=1&source=gbs_hplp_fict");
          URLConnection yahooConnection = yahoo.openConnection();
          BufferedReader br = new BufferedReader
            (new InputStreamReader(yahooConnection.getInputStream()));
          int start = 0;
          while ((inputLine = br.readLine()) != null) {
            wholeHtml += inputLine;
            if (inputLine.contains("<table")){
                      ++start;
            if (start != 0) {
              System.out.println(inputLine);
            if (inputLine.contains("</table>")) {
              --start;
        catch (MalformedURLException me) {
           System.out.println("MalformedURLException: " + me);
        catch (IOException ioe) {
          System.out.println("IOException: " + ioe);
        }So any help would be really really appreciated....
    The code should take care of nested tables also..
    So guys looking forward for the generous help....

    I have already parsed the HTML and checked all the closing of tags and corrected the indent using Tidy and then I have applied this code so some other suggestions please

  • Query to display the tables with referential integrity

    Hello,
    I need to display the Tables which are having referential integrity..
    Like need to dispaly the parent and child tables
    Please give me some idea on this..
    Thanks,

    Here's a nice query you can use:
    with temp_constraints as (
    select table_name
    ,      constraint_name pkey_constraint
    ,      null fkey_constraint
    ,      null r_constraint_name
    from   user_constraints
    where  constraint_type = 'P'
    union all
    select a.table_name
    ,      a.constraint_name pkey_constraint
    ,      b.constraint_name fkey_constraint
    ,      b.r_constraint_name
    from   user_constraints a, user_constraints b
    where  a.table_name = b.table_name
    and a.constraint_type = 'P'
    and b.constraint_type = 'R'
    select rpad( '*', (level-1)*2, '*' ) || table_name relation
    from   temp_constraints
    start with fkey_constraint is null
    connect by pkey_constraint <> r_constraint_name
    and prior  pkey_constraint = r_constraint_name;From http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:661009003696#tom69115451356231

  • What are all the tables used for this report:

    hi
    what are all the tables used for this report:
    report:
    •     <b>Stock Report, which will give opening balance, receipt, issue, and closing balance for any given Duration for any material.</b>
    thanks in advance

    Tables: MSEG, MKPF, MARD.
    FOR REFERENCE SEE TRANSACTION : MB5B.
    Message was edited by: Sharath kumar R

  • Error when displaying the table

    hellow,
        here i have to .htm pages, in first page i am entering the table name, and it has to display the table details in second page.
    but in second page i am getting error like field catalog not found
    plz help me.
    with regards
    babu

    hi babu rs
    Please post the code of the two bsp page with the layout as well as abap code. Only than anybody can help you.

  • What are the tables used for ACR & Master data daemon job?

    Hi Experts,
    What are the tables used in the backend for ACR & Master data daemon jobs. I would like to see the details of CHANGERUNMONI or ACR/Hierarchy Change run.
    Kr,
    Praveen

    Hi Praveen,
    Have you tried these tables BALHDR, BALDAT and BALOBJT for checking master date daemon delta status. It may not give you complete details. but definitely helps.. If you find any more details please do let me know..
    Thanks,
    Bharath

  • What are the tables used for this Report

    hi all..
    i am a fresher for ABAP. i need the help.
    what r the tables used for this report.
    Reports provide pending order details according to Material wise and customer wise for particular month.
    thanks in advance
    RK.Ashokkumar.
    9994262112.

    hi
    good
    try with these tables,
    MARA
    KNA1
    thanks
    mrutyun^

  • What is the table used outgoing payment to vendors?

    What is the table used outgoing payment to vendors?
    And which field in the table records the tax code

    Hi Priyanka,
    We need to make clear that which table is used in different step in purchasing process regarding to tax.
    For example,
    When I post a PO, I can input tax code for each line item. Which table is used to store such information?
    When I post an invoice, I can also input tax code. Which table is used to store such info? As far as I know, it is BKPF, right?
    And in the actual outgoing payment, can I input different tax code from PO or invoice. If so, which table is used to store such info?
    Thanks a lot in advance.
    Best regards
    Eda

  • If we open a transaction i need to find what are the tables used

    hi gurus
    can anyone suggest me
    if we open a transaction  liek va01
    i need to find what are the tables used
    what are the fields used in that transaction
    i need a list .
    thanks&regards
    kals.

    Hi
    you can find all those details in transaction variant,
    go with SHD0 ( numerical 0) and then enter your transaction code and enter transaction variant name and then select that
    Select the program SAPMV45A and go CHANGE WITH PROCESSING (F6),
    there you can find the list of fields and field names.
    reward points if usful.
    thanks and regards,
    muralidhar

  • What are all the tables used? experts help me

    hi
    what r all the tables used for this report.
    <b>Delivery Performance Report - to compare the customer delivery schedules with the deliveries created in SAP to determine whether they are early, on-time, or late. This measurement is done by comparing the customer request date against the goods issue date from the delivery</b>
    please any one help me
    thanks in advance

    hi.
    If you know standard transaction or program for purchase order or for any function . you can know the affected tables by that transaction or program USING TRANSACTION
    'SE49'.
    I am working on 4.6c it does exist in this version.
    if does not exist on ur version
    then other way to find affected tables by  a transaction or program is--
    first find the development class for that transaction (like Va01) then goto se80 and enter that development class .it will show all the tables affected .
    steps to find Development class for example (Va01).
    press F1 to any field then click on tech. info
    (ii) double click on program name(SAPMV45B).
    (iii) click on object directory entry in GOTO menu.
    (iv) from here u will get Development class (VA).
    now in se80 u will get all the databasec tables under the node object entry.
    hope this will help.
    Regards .
    vikas

Maybe you are looking for