For some reason only [COLUMN_NAME]
is returned? It is connecting to a MySQL database running on a local host.
Here is my code:
public static String[] getCol() throws Exception {
try {
Connection con = dbc.getConnection();
PreparedStatement statement = con.prepareStatement("select column_name from information_schema.columns where table_name='particles'");
ResultSet result = statement.executeQuery();
ResultSetMetaData rs = result.getMetaData();
int count = rs.getColumnCount();
String[] ColName = new String[count];
String[] COLS;
for (int i=1 ; i <= count; i++) {
ColName[i-1] = rs.getColumnName(i);
}
System.out.println(Arrays.toString(ColName));
return ColName;
} catch(Exception e) {
System.out.println(e);
}
return null;
}