Results 1 to 2 of 2
  1. #1
    patstan is offline Member
    Join Date
    Oct 2014
    Posts
    13
    Rep Power
    0

    Default How to insert multidimensional array into MySQL database

    So i have a multidimensional array as follows:

    Java Code:
    int[][] multiarray = {
    				{ 0, 1, 0, 1, 0 },
    				{ 1, 0, 1, 0, 1 },
    				{ 0, 1, 0, 1, 0 },
    				{ 1, 0, 1, 0, 1 },
    				{ 0, 1, 0, 1, 0 },
    
    };

    I have a MySQL database with 5 columns.

    How would i insert this multidimensional array into the database? I am not a java expert and any code will be appreciated.

    Thanks

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    13,541
    Rep Power
    26

    Default Re: How to insert multidimensional array into MySQL database

    If each row in your array represents a row in the database, then loop over the array and use a PreparedStatement to INSERT a row with the relevant values.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

Similar Threads

  1. Create registration form | insert into database | call the database
    By FamilyGuy in forum JavaServer Pages (JSP) and JSTL
    Replies: 3
    Last Post: 04-23-2012, 11:08 AM
  2. Replies: 3
    Last Post: 01-31-2012, 10:40 AM
  3. Multidimensional Array
    By TyCox94 in forum New To Java
    Replies: 11
    Last Post: 09-25-2011, 11:00 PM
  4. Multidimensional Array help
    By Gaebril in forum New To Java
    Replies: 1
    Last Post: 04-09-2011, 08:36 PM
  5. Replies: 3
    Last Post: 02-28-2009, 09:17 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
  •