Save my array in mysql db

Hi,
I have the neccesity to save my java array into mysql db, as I must make??
I have felt to speak of blob... I can use this object?? mysql have blob how type of field, but after as I must make for to recover my array??
thanks in advance
by
ps.sorry for my bad english...

Blob newBlob = connection.createBlob(); // no such call is supplied
newBlob.setBytes(...);  // or getOutputStream() - put blob data on
                           // database
PreparedStatemt stmt =
connection.prepareStatement("INSERT INTO db(blob,other..)
VALUES(?, ?...)");
stmt.setBlob(1, newBlob); // inserts OID of data just written
stmt.executeUpdate();please note it has not been tested and you might have to modify it, plus its just an example on how you could do it

Similar Messages

  • Main.vi creates 2D Arrays and I want to save the arrays in an microsoft Excel file(e.g engine_1)and in differnt worksheets(e.g. measure_1;measure_2;...)

    main.vi creates 2D Arrays and I want to save the arrays in an microsoft Excel file(e.g engine_1)and in differnt worksheets(e.g. measure_1;measure_2;...)
    The path(Grundpfad)for the excel file should be inserted in the main.vi.

    1. There's a shipping example called Write Table To XL.vi (Help>Find Examples>Communicating with External Applications>ActiveX>Excel) that you can use as a starting point.
    2. Buy the LabVIEW Report Generation Toolkit. Info can be found here.
    3. Search this forum for other examples of writing to Excel.

  • Best Practice: Storing an array in MySQL

    Hi,
    I'm working on an app that uses Flex 2, Coldfusion and MySQL.
    I'd like to store an array (or in this case an ArrayCollection)
    into my db. I'm not totally sure if I can do this. I read something
    about PHP having an implode command but I'm wondering what the best
    practice would be for trying to get an array into MySQL via
    ColdFusion.
    I'd be grateful for any advice.
    Novian

    Thanks, mike_the_maven.
    I'm not familiar with that tag but I'll definitely look into.
    I'm also wondering about potentially storing my ArrayCollection as
    a BLOB in MySQL. Any thoughts about this approach?
    Thanks.
    Novian

  • How to save the array elements

    hi,every body
    I need to save the array elements,for later use,can you tell me how?

    here you go.
    Message Edited by Root Canal on 10-21-2008 02:50 PM
    global variables make robots angry
    Attachments:
    write some stuff and read some stuff.vi ‏47 KB
    write some stuff and read some stuff.PNG ‏19 KB

  • Save 2D array in write to spreadsheet file

    Hello,
    I want to save 2 signals coming from 2 channels in  1 file ( as a 2D file:
    column 1 for signal coming from channel 1, and column 2 for signal coming from channel 2).
    How I can do it?
    See my example please. I can save these 2 signals on 2 different files.  I
    can not find a way to put them in on file.
    Thank you so much.
    Pascal
    Attachments:
    2 signal save.vi ‏80 KB

    Since the output of AI Read is a 1D array of waveforms you have to extract the data of each waveform and create a 2D array in order to feed that to the Write to Spreadhsheet File VI:
    You'll need to check on the transpose. Note that doing this will lose the timing information. You may want to use the Write LabVIEW Measurement File Express VI instead.
    Also, any reason why you have a loop set to run just once?
    Message Edited by smercurio_fc on 03-19-2008 03:16 PM
    Attachments:
    save 2D.png ‏3 KB

  • Save byte array (image) to file with servlet

    Good day.
    I should must to save a png image to file.
    I have a byte array of the image.
    This work is in a servlet.
    How can I do it?
    Best regards.
    Stefano Errani

    Good day.
    I have a byte[] and then I have used
    FileOutputStream fos = new FileOutputStream(getServletContext().getRealPath("/public_html/mcfoto/foto1.png"));
    fos.write(bt, 0, bt.length); // byte[] bt
    fos.close();
    This on my web server that has public_html as root web directory.
    The server is in multi domain.
    In this mode I have an error.
    Then I have tryied to use
    FileOutputStream fos = new FileOutputStream("http://www.stefanoerrani.it/mcfoto/foto1.png");
    and
    FileOutputStream fos = new FileOutputStream(getServletContext().getRealPath("http://www.stefanoerrani.it/mcfoto/foto1.png"));
    In both ways I have obtained an error.
    At last I have tryied in my localhost (local machine) using
    FileOutputStream fos = new FileOutputStream(getServletContext().getRealPath("/mcfoto/foto1.png"));
    All run correclty.
    The Application Server is Tomcat with Apache HTTP Server.
    The first server (of www.stefanoerrani.it) has Linux as OS.
    My local server has Windows as OS.
    I should want, if it's possible, an help.
    Best regards.
    Stefano Errani

  • How to save Byte Array of raw data into JPEG image.

    Hello!
    I have a image and I stored its data as byte array as
    bimage = bitmap1.getRawData();
    now I have Byte[] bimage, I want to save it as .jpeg image.
    and show that image..............

    the short way is this:
    ImageIO.write(bimage, "jpeg", new File("image.jpg"));
    Where you use the original Image object... but it has to be a java.awt.image.RenderedImage (which a java.awt.image.BufferedImage is). So this method would come in handy.
         public static BufferedImage getBufferedImage(Image img) {
              // if the image is already a BufferedImage, cast and return it
              if((img instanceof BufferedImage) && background == null) {
                   return (BufferedImage)img;
              // otherwise, create a new BufferedImage and draw the original
              // image on it
              int w = img.getWidth(null);
              int h = img.getHeight(null);
              BufferedImage bi = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB);
              Graphics2D g2d = bi.createGraphics();
              g2d.drawImage(img, 0, 0, w, h, null);
              g2d.dispose();
              return bi;
         }If the byte array you have is raw image data, then you can look at the javax.imageio package and see what you can do with those classes.

  • Saving String-Array in mySQL DB

    Hello.
    How can I save an dynamic array in a DB, without looping over
    the content.
    I think serialization is the key word. Can anybody give me
    further information, pls?
    Thx an lot.
    Regards, Philipp

    I am working with 3-dimensional string arrays, which have
    differet sizes.
    I think enum-Cols can't solve my problem.

  • Save 2d array to disc

    I am trying to save 2d  collected data in array indicator to file on a button click , and resetting it  .
    I can see values filled in Array indicator , but when i save it to file .
    only three rows are beeing saved. what i am doing wrong ?
    Thanks in advance. 
    Attachments:
    fsthistSCR.jpg ‏455 KB

    If you attached a VI rather than a picture, we might be able to help figure that out.
    Why are you using a local variable of the array in the inner most case structure rather than the array wire that is right there?  It is possible you have a race condition where the value in the Array variable is read before the latest data is written to the Array terminal.
    Are you sure you have more than 3 rows going to the Write to Spreadsheet File?  Have you tried running with probes?  Put extra indicators in there to see what the dimensions of the 2-D array actually are?

  • Save byte[] array to file

    Hi,
    I've read a .jpg picture off the hard disk and stored in a byte[] array. I've altered some of the bytes and want to save the file back to .jpg. Is there a method available in java which allows me to do this?
    Thanks and regards,
    Krt_Malta

    FileOutputStream#write(byte[] array).

  • Retrieve LV stored 2D-Array via MySQL C-API

     Hello everybody!
    I am not quite sure, if this is the right place for my question, but I'll just give it try.
    I have a LabVIEW Vi which performs Data Acquistion-Tasks. The Data is stored in a MySQL-Database using the Labview Database Connectivity Toolset. One part of the stored data is a 2D-Double-Array. For storage in MySQL It is automatically converted to Binary Data and the stored in a MySQL Blob-Field.
    Unfortunately, the software to process the data is written in C++. It was fairly easy to establish the communication between my c++ application and MySQL via the MySQL C-API. But now i'm struggling to retrieve the Binary-Data from the Database and reconvert it into a C++ Double Array, as am not very experienced with C++.
    Has anyone done something similar before?

    Hello
    I am happy to hear that your LabVIEW application and data storage with the LabVIEW Database Connectivity Toolkit works.
    Unfortunately is this the wrong platform to ask about C++. There are many other open platforms discussing C questions. I’d propose you to ask your question there.
    Best Regards
     Daniela Biberstein
    NI Switzerland

  • Save my object in mysql db

    I have create my class with this constructor method:
    public Offerta(final Destinatario destinat, final Date date, final String numeroofferta, final String totale)
    this.destinat = destinat;
    this.date = date;
    this.numeroofferta = numeroofferta;
    this.articles = new ArrayList();
    this.articleCounts = new ArrayList();
    this.totale = totale;
    next in another program i have an offerta object:
    Offerta offerta = new Offerta(destinat, new java.util.Date(), "1", "565");
    How can save this offerta object in a mysql db and how to retrieve it ?

    You can use ObjectOutputStream to create a byte[]
    The byte[] can be saved to the DB.
    Then use ObjectInputStream to read the object back in.
    Note: If you change the inteface for the class, or any class it uses or the version of JVM your object may become unreadable.

  • How can I configure the Databse Options to save an array of strings to a table?

    I have a list of devices associated with a particular test and I have an array with the serial numbers of all the devices. In order to log this information to a database, I created a table with two fields: UUT_RESULT_ID, and DEVICE_SERIAL_NUMBER. Both of this make-up the Primary Key. I need to store each element in my array to a different row in the table and use the ID from the UUT_RESULT table as a foreign key in my new table.
    I could write some code to log this data in the database afterwards but I need to know what was the ID generated in the UUT_RESULT table, and I would not like to assume that the last record in that UUT_RESULTS table is what I'm looking for.
    Any ideas?

    Well, well, well! Looks like I'm answering my own question here! After trying many many things, I finally figured this out and I wanted to share the information in case anyone else needs it.
    I needed to save multiple rows of data in a table of my database for every UUT. The configuration screen for the database options allows you to insert statements into your schema. By inserting multiple statements that save data in the same table, you insert multiple rows in that table. The problem with this solution, is that you must know how many elements or how many rows you will be saving and you should create a statement for every element in your array.
    In my case the array could have any number of elements.
    The solution is to modify the DatabaseOptions parameter in
    the process model dynamically. There is a callback in the process model called LogToDatabse. It calls a sequence in Database.seq. To dynamically modify the DatabaseOptions insert steps before this call that insert the elements you need into Parameters.DatabaseOptions.DatabaseSchema.Statements.
    This worked great for me!

  • How to save an entity into mysql?

    public class getButton extends CustomNode{
        var x:Number;
        var y:Number;
        var h:Number;
        var w:Number;
        override function create():Node{
            SwingButton{
                translateX:x;
                translateY:y;
                onMouseClicked:function(e:MouseEvent){
                    var request:HttpRequest = HttpRequest {
                        location: "http://localhost:8080/catalog/resources/fucks/1/";
                        onInput: function(is: java.io.InputStream) {                 
                        try {
                            println("onInput - bytes of content available: {is.available()}");
                        } finally {
                            is.close();
    }I just wanna let the text typed in the textfield be saved into the mysql as an entity.
    what should I do in the "try" part?
    Should I use parse?
    Can anyone give me a very simple sample?

    Do you have a Web service already available to do that? What you will put in 'try' will depend on the Web API the service offers. In your case, it might be as simple as accessing an URL like: http://my.web-service.com:8088/api/store.jsp?data=String+you+typed
    The URL above is strictly invented, it might (probably) lead to a real site but it won't work! ;-) Replace with a real URL you own, can be localhost, might drop the port (depends on your configuration), the path and page name are up to your taste, not restricted to JSP (can even be PHP, or Python, Perl, whatever).

  • How do you save arrays in tdm files?

    Hi,
    As part of a university project I am trying to save some program data to a .tdm file.  On each channel I wanted a number of different types of data including an analogue wave form and a couple of 1-D DBL arrays.  I have found an NI presentation that says that you can store arrays in them but dont seem to be having any luck.  Any ideas what Im doing wrong?  I am using labview 8.5.
    Regards,
    James

    Hi James,
    in a channel, you can save only one array as data. If you want to save more arrays then use several channels. You can organize them in groups. If the arrays must be in the same channel, then convert them to a spreadsheet string (in string palette) and save the string as a property.
    Greetings,
    shb

Maybe you are looking for

  • Animated .gif not running in mobile devices

    It's normal that animated .gifs (as the .gif preload gallery of Edge) don't move in mobile devices?

  • Composite primary key in oe_order_headers_all table?

    Hi all What are columns involved in composite primary key in oe_order_headers_all table? how to identify that? (Order_number, order_type, org_id) are the combination of composite primary key or anything else ?

  • Role of a SAP SD fresher

    hi gurus please explain following queries? 1.what will be the position of a sap fresher while entering into SAP. 2.Where he will be placed in support or in implementation 3.can any one explain roles and responsibilities of SAP consultant as per the A

  • Substitute Component independent of the BOM

    Does Oracle have the concept of a substitute component, irrespective of the BOM in which it could exists? For example, Component A can always be replaced by Component B. This would be applicable to Product X or Product Y, both of them use Component A

  • ZFS I/O read policy

    I'm trying to find out what defines the I/O read policy on ZFS is. In most volume managers, there's a setting for read policy (e.g. disksuite has roundrobin, geometric or first), but there doesn't seem to be anything for zfs that I can find. The reas