This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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 Android Security Essentials Live Lessons this week in the Android 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).]
 
wood burning stoves
 
subject: Write an array to a file, via a recursive sql-statement
 
Similar Threads
SQL query to retrieve all nodes from X up until the root node in a tree structure
All combinations of an int array
Caching in an EJB container
Ajax performance on getting data from backend?
new jdbc exception