Search Results

Search found 1 results on 1 pages for 'litecia'.

Page 1/1 | 1 

  • add database Tablenames to the JList in java

    - by Litecia
    // Declare JList private JList jlstTab, jlstCol; . . . DefaultListModel dlmTables = new DefaultListModel(); DefaultListModel dlmCol = new DefaultListModel(); // Instantiate dlmTables.addElement("kl"); jlstTab= new JList(dlmTables); jlstTab.setSelectedIndex(0); jlstTab.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); . . . . Connect to the database public static void main(String args[]) { DBToolSwing cs = new DBToolSwing("DB Tool Swing"); try DBAccessObject dbAccess1 = new DBAccessObject("jdbc:odbc:JavaClassDSN"); DBAccessObject dbAccess2 = new DBAccessObject(); ResultSet rsTables = dbAccess1.getDatabaseTableNames(); while (rsTables.next()) System.out.println(rsTables.getString("TABLE_NAME")); I need to get the table names from the database, the output shouldn't be printed on the screen, instead I need the output added to the JlstTab so dlmTables.addElement("TABLE_NAME"); Please if someone can help I would appreciate it. Thanks in advance.

    Read the article

1