Possible to insert array into db without looping?

Hi there,
I'm working on a Flex project that uses cfc's and MySQL. I
have an ArrayCollection that I want to store in my db. I was
thinking that I could store it as a BLOB. I'm taking a stab at it
now but I thought I'd put the feelers out to see if anyone has any
ideas of how to do this.
Maybe a simpler way to put it:
Is it possible to save an entire array into a database
without looping through and storing each item in the array
separately?
Thanks.
Novian

For 1 dimensional arrays, you can either convert the array to
a list - ArrayToList() or for more complicated structures you can
serialize your data using XML, WDDX (a type of XML) or JSON. WDDX
support is native to CF, you can find components online that will
give you JSON support or you can roll your own XML
conversion.

Similar Messages

  • Is it possible to insert data into a MySQL database with Java?

    Hello everyone!
    I would like to know, if it's possible to insert data into a MySQL database, with a JFrame inside a servlet?
    When the JFrame is first created it calls this method:
         * Connects the servlet with the MySQL database.
        private void connect(){
            try{
                Class.forName("com.mysql.jdbc.Driver");
                connection = DriverManager.getConnection(
                        "jdbc:mysql://localhost:3306/data", "root", "omfg123");
            }catch(ClassNotFoundException cnfe){
                cnfe.printStackTrace();
            }catch(SQLException sqle){
                sqle.printStackTrace();
        }Then, when you click the "Add" button, it executes this code:
                add.addActionListener(new ActionListener(){
                    @Override
                    public void actionPerformed(ActionEvent ae){
                        String employee = employeeName.getText();
                        String[] args = employee.split(" ");
                        firstName = args[0];
                        lastName = args[1];
                        execute();
                });And this is my "execute()" method:
         * Connects the servlet with the MySQL database.
         * - And executes the SQL queries.
        private void execute(){
            try{
                PreparedStatement statement = connection.prepareStatement("insert" +
                        " into employees values(" + firstName + ", " + lastName
                        + ")");
                ResultSet result = statement.executeQuery();
                String fullName = firstName + " " + lastName;
                printer.write("Employee " + fullName + " added.</br>");
            }catch(SQLException sqle){
                sqle.printStackTrace();
        }But when I click the "Add" button, nothing happens.

    This is what I use to insert into mysql. It works on windows.
    try {
                Class.forName("com.mysql.jdbc.Driver");
                String connectionUrl = "jdbc:mysql://" + loadip + "/custsig?" +
                        "user=root&password=";
                Connection con = DriverManager.getConnection(connectionUrl);
                newproc = jTextField1.getText();
                newsoft = jTextField2.getText();
                newdeb = jTextField3.getText();
                newcust = jTextField4.getText();
                if (newcust.equals("")) {
                    errorsig12 = 1;
                    jLabel1.setForeground(new java.awt.Color(255, 0, 0));
                } else if (newsoft.equals("")) {
                    errorsig12 = 1;
                    jLabel2.setForeground(new java.awt.Color(0, 0, 0));
                } else if (newproc.equals("")) {
                    errorsig12 = 1;
                    jLabel3.setForeground(new java.awt.Color(0, 0, 0));
                } else if (newdeb.equals("")) {
                    errorsig12 = 1;
                    jLabel4.setForeground(new java.awt.Color(0, 0, 0));
                if (errorsig12 == 0) {
                    PreparedStatement ps = con.prepareStatement("insert into customer set cust_name = ?,  software = ?, processor = ?, debit = ?");
                    ps.setString(4, newdeb);
                    ps.setString(3, newproc);
                    ps.setString(2, newsoft);
                    ps.setString(1, newcust);
                    int rs = ps.executeUpdate();
            } catch (SQLException eg) {
                System.out.println("SQL Exception: " + eg.toString());
            } catch (ClassNotFoundException cE) {
                System.out.println("Class Not Found Exception: " + cE.toString());
            }

  • Although it is possible to insert podcasts into a playlist on the Mac, these are not in the playlist on the iPod after SYNC

    although it is possible to insert podcasts into a playlist on the Mac, these are not in the playlist on the iPod after SYNC

    Sambino,
    You should be fine. Just make sure that you download and install the P2 drivers for your PB. Also, if possible transfer directly to your external. P2 cards can eat up a lot of space very quickly and you don't want to overburden your system drive.
    K

  • Please recommend if we have options to read xml file and insert data into table without a temporary table.

    Please recommend if we have options to read xml file and insert data into table without a temporary table. 

    DECLARE @data XML;
    SET @data =N'<Root>
    <List RecordID="946236" />
    <List RecordID="946237" />
    <List RecordID="946238" />
    <List RecordID="946239" />
    <List RecordID="946240" />
    </Root>'
    INSERT INTO t (id) SELECT T.customer.value('@RecordID', 'INT') AS id
    FROM @data.nodes('Root/List')
     AS T(customer);
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • Is it possible to import music into iPad without using iTunes?

    Do any of of you know whether or not it is possible to import music into iPad, like when you can import pictures, without the use of iTunes ( I don't have a computer)? I have music on my phone and on USB flash drives. Thnx

    If you are in America then you can download your past iTunes music purchases via the store (http://support.apple.com/kb/HT2519). But no, you can't import from flash drives (the camera connection kit can only import photos and videos) or from an iPhone.

  • Is it possible to insert data into two Excel worksheets using Report Generation Toolkit?

    I'm using the toolkit to insert data into two separate worksheets in Excel using named cells. The problem is that it tends to favor one sheet or the other. In other words, one sheet will have data and the other no data and vice versa. (Sometimes I get data in both sheets.) Is there something I can do to clear this up or is what I'm trying to do unreasonable? I would like to use two worksheets so one sheet receives text and data. The other sheet is used to format the data into a printable report. (i.e. using Excel's CONCATENATE function) The second (report) sheet is also used to receive plots (JPEG files) from LabVIEW. I'd send the plot images to the first sheet, but I can
    not see a way to automatically transfer images from sheet to sheet. I'm using LV 7.1, Win2000 and Toolkit v.1.0.1

    Hi,
    You can use the "Excel Get Worksheet.vi" under All Functions >> Report Generation >> Excel Specific >> Excel General to specify a particular worksheet as the current worksheet. Then, you can specify which worksheet you want to write to in your VI.
    Let me know if you have any further questions and good luck!
    Kileen C.
    NI

  • Is it possible to insert hyperlinks into Dev Forms Code?

    Does anyone know of a way to insert hyperlinks into forms once
    it's deployed? For example, if I want the user to click on a
    button "when-button-pressed" code that will take them to a
    website.
    thanks
    null

    Ares (guest) wrote:
    : Does anyone know of a way to insert hyperlinks into forms once
    : it's deployed? For example, if I want the user to click on a
    : button "when-button-pressed" code that will take them to a
    : website.
    : thanks
    Why don't you use WEB.SHOW_DOCUMENT inside your "when-button-
    pressed" trigger?
    Yar
    null

  • How to change a file name or insert something into it without having to make the mouse hover over it, often opening the image instead?

    Huurah for Apple, most of the time....But in soime matters I miss my old PC. This business of having to hover the mouse over a text is something I just cannot master. Is there a better way??

    I can only guess at what you are asking.
    If you want to rename a file without selecting it, there isn't a way.
    You can just hit Return to get into the Rename mode, but you have to do something to select the file, first.

  • Is it possible to insert P2 into a PWBK G4?

    dear all, I have already posted this but it was a nested reply in another topic. I think nobody will never find it. So, I post it as indipendent topic.
    I hope someone will solve my problem just saying that my workflow is ok... I hope...
    I will use a AG-HVX200 HD camera and I will use P2 cards for the first time.
    The question is: will my powerbook g4 accept those P2s into its PC slot? The specifiction sheet of the PBg4 by Apple says that my machine can accept Pc card type I and II. And I think P2 cards are type II.
    Then I would transfer from P2 to Internal Hard Drive and then to Ext. Lacie 250 GB HD. Does it sound correct to you?
    I got scared as someone said to me "you will need an adapter for your mac, as you do not own a PC. Macs have different slots than ones required by P2 cards".
    thank'you.
    Alex

    Sambino,
    You should be fine. Just make sure that you download and install the P2 drivers for your PB. Also, if possible transfer directly to your external. P2 cards can eat up a lot of space very quickly and you don't want to overburden your system drive.
    K

  • Is it possible to insert media into Adobe Muse slide show?

    Is someone can help me out my question? Thanks.

    You can use compositions for this as with slideshow we cannot insert any other element.
    Thanks,
    Sanjit

  • Insert array into colums

    i have a global devices..
    2d array..
    i want to check the first element
    copy SN from row 1 - 65
    copy gain = 7 from row 1 - 65
    set kPT0, kPT1, t37, mT, CalVal to ZERO (O)
    Message Edited by krispiekream on 03-28-2008 05:16 PM
    Best regards,
    Krispiekream
    Attachments:
    array1.PNG ‏57 KB

    thats what i thought too..
    i am always getting an error when i tried that..
    something about..
    Message Edited by krispiekream on 03-28-2008 06:18 PM
    Best regards,
    Krispiekream
    Attachments:
    untitled1.PNG ‏53 KB

  • Inserting Array into listModel

    String [] array1 = new String[3];
    array1[0] = "d";
    array1[1] = "d";
    array1[2] = "d";
    listModel.add(array1)
    I do not know the method for adding the array I have tried everyone I think could work but all are incompatible
    It obviously wants an object anyway I convert this string or make it act like an object

        String [] array1 = new String[3];
            array1[0] = "d";
            array1[1] = "fg";
            array1[2] = "g";
            listModel.copyInto(array1);
       List<String> strsInAList = java.util.Arrays.asList(array1);
    jTextField1.setText(strsInAList.get(0));
    jTextField2.setText(strsInAList.get(1));
    listModel.addElement(strsInAList);Store that array in that listbox is proper list format like
    d
    fg
    g

  • Insert data into array

    I want to know if its possible to insert data into an array, but I wish to do it as I would in excel, by using the option of insert row.
    Is it possible to insert a value into an array in a specific row, so that all the other values after the one that was inserted are moved one row down?
    Please let me know how to do this, and if you could please provide some sample code, that would be great.
    Thanks!

    I tried using the array subset, but I still can't get the result that I want.
    What I want is to be able to add elements to the array, and that element should be added to a specific category (defined by one of the text rings).
    Example: in the category, I have the first one and in the elements (second text ring) I have the second one. The element that I will add will be in the 3rd position of the category that I selected. So if I have a category of DVDs, and in the items I have 2 brands (TDK, Maxell), and I will add Sony as the 3rd item in the second text ring that is being populated depending on the selection in the first text ring.
    How can I add items to the second text ring, so that they only appear in the category that I selected in the first text ring?
    Thanks in advance!

  • Truncating an array within a for loop

    I'm currently working with a program that builds an array of 3000*N real numbers, where N is a control that I specify. I want to pass this array into a for loop that runs N times, each time splitting the first 3000 numbers of the array. So, in other words I want the for loop to execute enough times such that the initial array will be completely divided into groups of 3000 when I'm finished. Later I'll be finding the maximum value of all of these subarrays and taking the average of those. What I tried first is to pass the array into the for loop, then truncate it at index = 3000, but the problem is that I can't hard code the loop to do this N times. Any advice or other methods you'd recommend for doing this?
    Thanks.
    Message Edited by Robtn on 03-05-2010 03:17 PM

    Mark--I don't think I can use that approach. Let me be more specific on what the problem is:
    Our "big program" is a giant while loop that constantly reads in voltage values from a DAQ assistant.
    It has two modes, the first of which I'm having a lot of trouble with. This mode uses a for loop (N = 3000) nested within the giant while loop.
    When the for loop activates, the DAQ assistant takes reads 300 samples for every iteration and takes the maximum of those 300 values. It then builds an array composed of all the maxima. After the for loop has executed 3000 times, a case structure activates, which then finds the maximum of the array of maxima.
    I want this (N=3000) for loop to execute an arbitrary number of times, a number that I will specify. Each of those times it should generate a completely seperate array of maxima. So, if I want the for loop to run 5 times, I want 5 different arrays.
    My approach for doing this was to change N=3000 to say N = 15000, then split up the resulting array 5 times. So, I need an entirely separate for loop that reads in this array of 15000 maxima on its own and splits it 5 ways. I think what you're suggesting is to use a for loop outside of the N=3000 loop, which is a good idea in theory, but experience has shown that this will not generate 5 separate arrays. It will actually concatenate each array into one, hence the problem we currently have.
    Yik--I won't have access to Labview over the weekend. Is it possible to take a screenshot and post it, or maybe a short description?
    Thank you for the responses.

  • Inserting variables into other variables

    I have several objects that have similar names, like slot1, slot2, slot3, etc. I also have a function that is supposed to do something to the first object, then the next, then the next, etc each time a button is pressed. Is it possible to insert variables into other variables? So say I have a variable called n that is increased each time the button is pressed. The function is then applied to slot"n" each time the button is pressed. How would I do this?

    use:
    var n:Number=1;
    function f(){
    // do something to parentmovieclip["slot"+n]
    n++
    p.s.  please mark this thread as answered, if you still can.

Maybe you are looking for

  • How to Install Windows 7 64Bit on Pavilion 15-p010sq

    Hello, Could you please indicate a procedure to install Win7 64 on my new 15-p010sq  (s/n:5CD43677ZJ) ? I have my Win Kit on USB and it missing its drivers, when I try to install it. I ve indicated some drivers from amd-catalyst-omega-14.12-sb-sata-a

  • Jsp tags in .html pages

    Hi Is possible to put jsp tags in pages .html? I try this example: <html> <head> <title></title> </head> <% out.print("teste"); %> <body> </body> </html> and the result in the page is the jsp code. Tomcat don't print "teste", print out.print("teste")

  • Saving the GOITEM-SGTEXT for MIGO doc. in MSEG Table

    Hi Gurus, I want to save the TEXT (GOITEM-SGTEXT) item for each line item in MIGO in the Table MSEG. But being Material NON-VALUATED, there is no Accounting Document generated for this MIGO document. So after inserting TEXT & posting the MIGO doc, th

  • Webservice error in browser. Not in SoapUI

    Hi everybody, I hope you can help me in solving a webservice issue... We are having a server in our network. This server has the IP 10.42.42.104. If you want to connect from the outside you must call 213.23.42.104. Then the firewall will redirect you

  • Org Model to CDB table SMOMITAREA

    I hope you can help.... When we download the Org Model to the CDB, the table SMOMITAREA is updated.  In this table is a field for 'Default' Sales Org for a business partner. Can you tell me what defines which Sales Org is default for a person in the