Olá sou novo no forum e estou com um problema para inserir dados de um resultset em uma JTable.
A JTable é gerada, as colunas são criadas, as linhas, porém ocorre uma exceção na linha de atribuição da classe
do tipo de coluna… segue fagmento do código e da exeção gerada.
Se alguém pode ajudar agradeço
…
@SuppressWarnings(“unchecked”)
public Class getColumnClass( int column )throws IllegalStateException
{
// assegura que o banco de dados conexão está disponível
if ( !connectedToDatabase )
throw new IllegalStateException( “Not Connected to Database” );
// determina a classe Java de coluna
try
{
System.out.println(column);
[color=red]String className = metaData.getColumnClassName( column + 1);[/color]
//System.out.println(className); :-o
// retorna objeto Class que representa className
return Class.forName( className );
} // fim do try
catch ( Exception exception )
{
exception.printStackTrace();
} // fim do catch
return Object.class; // se ocorrerem os problemas acima, assume tipo Object
} // fim do método getColumnClass
…
com.microsoft.sqlserver.jdbc.SQLServerException: O conjunto de resultados está fechado.
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(SQLServerException.java:171)
at com.microsoft.sqlserver.jdbc.SQLServerResultSet.checkClosed(SQLServerResultSet.java:345)
at com.microsoft.sqlserver.jdbc.SQLServerResultSetMetaData.checkClosed(SQLServerResultSetMetaData.java:56)
at com.microsoft.sqlserver.jdbc.SQLServerResultSetMetaData.getColumnClassName(SQLServerResultSetMetaData.java:235)
at modeloCheckList.ResultSetTableModel.getColumnClass(ResultSetTableModel.java:47)
at javax.swing.JTable.getColumnClass(Unknown Source)
at javax.swing.JTable.getCellRenderer(Unknown Source)
at javax.swing.plaf.basic.BasicTableUI.paintCell(Unknown Source)
at javax.swing.plaf.basic.BasicTableUI.paintCells(Unknown Source)
at javax.swing.plaf.basic.BasicTableUI.paint(Unknown Source)
at javax.swing.plaf.ComponentUI.update(Unknown Source)
at javax.swing.JComponent.paintComponent(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JViewport.paint(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JLayeredPane.paint(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paintToOffscreen(Unknown Source)
at javax.swing.BufferStrategyPaintManager.paint(Unknown Source)
at javax.swing.RepaintManager.paint(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at java.awt.GraphicsCallback$PaintCallback.run(Unknown Source)
at sun.awt.SunGraphicsCallback.runOneComponent(Unknown Source)
at sun.awt.SunGraphicsCallback.runComponents(Unknown Source)
at java.awt.Container.paint(Unknown Source)
at java.awt.Window.paint(Unknown Source)
at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
at javax.swing.RepaintManager.seqPaintDirtyRegions(Unknown Source)
at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(Unknown Source)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)