Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2010
    Posts
    1
    Rep Power
    0

    Default MySQL into an Array

    can any one provide me code for retrieving data from mysql to an array

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,305
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by Trad View Post
    My question is this, when this block executes exactly what variable is the program sending the words from the file to? Just glancing at it I'm assuming they are all being saved to a string. Which variable is the data going to? I know this might sound elementary to some of you but I am having a time figuring it out and want to make sure I do this correctly!

    Also, after that what method is used to convert my string into an array? You could just point me to the method I need to use that is provided by the Java program and I can probably look it up in documentation and it take from there.

    Thanks!
    If you change this comment line: '// process line of data' to an actual statement, such as:

    Java Code:
    System.out.println(line);
    ... you have an executable piece of code and you can see what it does by running it. The instruction wants you to add functionality at the '...' line. Also read the API documentation, you'll need it (sorry, no link, I didn't have my espresso yet ;-)

    kind regards,

    Jos

  3. #3
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    vikram,
    Please don't hijack another's thread but rather ask your new question in its own thread. Hijacked post moved into own thread and old thread locked.

  4. #4
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,751
    Rep Power
    19

    Default

    Quote Originally Posted by vikramlovely4u View Post
    can any one provide me code for retrieving data from mysql to an array
    What have you done so far, and what doesn't work?

    The basic structure is:
    get connection
    create or prepare a statement
    execute the statement to get the result set
    loop through the result set creating an object that represents the data returned for each row, storing that in a list.
    close everything in a finally block.

Similar Threads

  1. Replies: 23
    Last Post: 09-07-2010, 08:12 PM
  2. Replies: 2
    Last Post: 09-06-2010, 01:03 AM
  3. Convert Char Array to String Array
    By Mayur in forum New To Java
    Replies: 8
    Last Post: 10-12-2009, 11:41 AM
  4. Replies: 1
    Last Post: 03-31-2009, 06:40 AM
  5. MySQL/JDBC Mysql query output
    By thelinuxguy in forum Advanced Java
    Replies: 4
    Last Post: 02-13-2009, 01:57 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •