I want to write query results along with cloumn names into text file using Java, I am able to write the results but I dont see any option to wirte the column headers are also in text file. The file should contain column headers 1st and then the query results, any suggestions please?
You can get the column name indirectly from ResultSetMetaData.
Use the methos ResultSet.getMetaData() to get the ResultSetMetaData and then use ResultSetMetaData.getColumnCount() to get the no. of columns in ResultSet
Next iterate to get each column name using ResultSetMetaData.getColumnName(i)
SCJP 5.0 OCBCD 5.0(Formerly SCBCD)
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads