• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

how to pass the result of ResultSet to an outputfile

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
reply
    Bookmark Topic Watch Topic
  • New Topic