reformulando:
estou querendo fazer uma consulta no banco de dados, salvar em uma matriz e resultar em um jtable...
meu código ta assim:
public void ConsClinicas()
{
sql = "SELECT * FROM clinicas";
try
{
Class.forName(JDBC_DRIVER);
cn = DriverManager.getConnection(DATABASE_URL, "chmsa", "chmsa");
st = cn.createStatement();
ResultSet rs = st.executeQuery(sql);
ResultSetMetaData metaData = rs.getMetaData();
int coluna = metaData.getColumnCount();
String[] nomecoluna = new String[100];
String[][] nomes = new String[100][100];
int[] nome1 = new int[100];
String[] nome2 = new String[100];
int cont = 1;
while(rs.next()){
nome1[cont] = rs.getInt(1);
nome2[cont] = rs.getString(2);
cont++;
}
for(int i = 1; i<=coluna; i++)
nomecoluna[i] = metaData.getColumnName(i);
JFrame jf = new JFrame();
JTable tb = new JTable(nomes, nomecoluna);
jf.add(tb);
jf.setSize(400,400);
jf.setVisible(true);
tb.setSize(400,400);
tb.setVisible(true);
}
catch (SQLException e)
{
e.printStackTrace();
System.exit(1);
}
catch (ClassNotFoundException e)
{
e.printStackTrace();
System.exit(1);
}
na verdade ta meio bagunçado as matrizes/vetores, pq ja que eu nao consegui ver como fazer com matriz, eu passei pra vetor...
bom, eu sei q nao vai funfar o codigo, mas teoricamente, eu estou no caminho certo néw?