I am using CsvJdbc (it is a JDBC-driver for csv-files) to access a csv-file. I don\'t know how many columns the csv-file contains. How can I get the number of columns? Is th
This will print the data in columns and comes to new line once last column is reached.
ResultSetMetaData resultSetMetaData = res.getMetaData();
int columnCount = resultSetMetaData.getColumnCount();
for(int i =1; i<=columnCount; i++){
if(!(i==columnCount)){
System.out.print(res.getString(i)+"\t");
}
else{
System.out.println(res.getString(i));
}
}