Win a copy of Java 9 Revealed this week in the Features new in Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

how to pass the result of ResultSet to an outputfile  RSS feed

 
sagarika chinya
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am new to java and jdbc, I have used ResultSet to query the database.I wanted to know how to store the result in a outputfile
ie
ResultSet rs = stmt.executeQuery(query);
while(rs.next()) {
String str = rs.getInt("movie_id");
String str2 = rs.getString("ReturnDate")
can i use FileOutputStream,OutputStreamWriter,BufferedWriter and PrintWriter to write the str and str2 into an output file,

any help would be appreciated.
thanks
sagarika
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!