File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes Write an array to a file, via a recursive sql-statement Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Write an array to a file, via a recursive sql-statement" Watch "Write an array to a file, via a recursive sql-statement" New topic
Author

Write an array to a file, via a recursive sql-statement

Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Hello. First I must excuse myself. I'm a totally new beginner in Java, and could really need some help about an idea I have got. I want to retrieve some data from a table with a recursive sql-statement. Then the retrieved data are to be written to a .js-file. The catch is that the data has to be represented in an array with array's ( the structure of the .js-file have to be an array with arrays). Does anybody have an idea of how to put that kind of code together in an easy way? Thanks for helping me out. I guess I just need an example to really get started on this.
------------------
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
You will probably find more help for SQL problems in the JDBC forum. A rough overview of how I would go about this would be as follows:

  1. Create a JDBC connection to my datasource

  2. Execute a SQL Statement and capture the result in a ResultSet

  3. Step through the ResultSet using the next() method inside of a loop

  4. On each pass, write out one line of my .js file


  5. HTH
    [This message has been edited by Bodie Minster (edited May 02, 2001).]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Write an array to a file, via a recursive sql-statement