public void MostrarDatosTabla(){
Connection cnn; modelo= new DefaultTableModel(); try{ cnn=Conexion.Conectar(); Statement smt=cnn.createStatement(); ResultSet rs= smt.executeQuery("select * from TUtabla"); ResultSetMetaData md=rs.getMetaData(); int columnas= md.getColumnCount(); for (int i = 1; i <= columnas; i++) { modelo.addColumn(md.getColumnLabel(i));} while(rs.next()){ Object[] fila = new Object[columnas]; for (int i = 0; i < columnas; i++) {fila[i]=rs.getObject(i+1);} modelo.addRow(fila); // fila=null; } tablita.setModel(modelo); cnn.close(); }catch(SQLException sqlex){ setTitle("Problema CargarDatos" +sqlex.getMessage()); }}