How can i  read a image from a oracle DB?

How can i read a image from a oracle DB?
Because in the DB a have a field that is a picture that i would like to show in a jpanel.....but this field is in oracle DB only has strange caracters ..... so Do i have to read this field like a input stream?....
Could some body help me please?
Thanks...
Mary

Well I suppose the picture is stored in a blob. If that is so this is some code I have used to load a picture to a panel. Hope you find it usefull.
PreparedStatement retreive = db.createPreparedStatement("select bl from test where ln = ?");
Blob bl;
try{
retreive.setBigDecimal(1, new BigDecimal(jTFln.getText()));
ResultSet rs = retreive.executeQuery();
if (!rs.next())
System.out.println("Empty Result Set");
bl = rs.getBlob("bl");
if (bl == null) {
System.out.println("Null Blob");
return;
InputStream is = bl.getBinaryStream();
int imageLength = (int) bl.length();
System.out.println(imageLength);
System.out.println(bl.length());
byte[] imageData = new byte [imageLength];
is.read(imageData, 0, imageLength);
image1 = new ImageIcon(imageData);
photo = new JPanel() {
public void paint(Graphics g){
g.setColor(Color.lightGray);
g.drawImage(image1.getImage(), 0, 0, this);
} catch (BadLocationException ble){
ble.printStackTrace();
} catch (SQLException sqle){
sqle.printStackTrace();
} catch (IOException ioe){
ioe.printStackTrace();
}

Similar Messages

  • How can I read the image from database into form

    hi everyone
    if I have table like this
    create table test
    (id number(10),
    pic long raw);
    in this table record
    in form If I have block non database
    how can i read the image into non database item
    I try with this code but no good
    select pic into :photo from test where id=5;
    photo its non database item kind image
    how can i invoke image into item
    thanks alooooooot

    Hello,
    You can't select image with select query. You need to create another database block from test table which has item binds with database pic column. Now in where condition in test block's property you have to write id=5. Change test block's properties UPDATE ALLOWED, INSERT ALLOWED, DELETE ALLOWED to NO. Only Query allowed property set to YES.
    Now in your particular trigger write the code
    GO_BLOCK('test');
    Execute_Query;
    please mark if it help you or correct
    Regards,
    Danish

  • How can i read a image from clipboard

    Hi all,
     Can you anyone help me to figure out this problem,actually i have an VI that capture screen image(similiar to print screen option in windows) & save it in a file.and now the thing is,its working in code,once if i converted that to EXE it is not reading that image from the clipboard .I have attached that VI along with this thread please check it.
    Attachments:
    Clipboard.vi ‏20 KB

    Hey,
    It seems that the Get Image from Clipboard method is not available for executables.
    The following thread gives a working example with a CIN -> http://forums.ni.com/ni/board/message?board.id=170&message.id=35987&requireLogin=False
    Christian

  • In My iphone 5s,i have disabled automatic download from whatsapp app.So whichever images,video i feel is good i download them and then save them to my camera roll section.So i want to know how can i remove the images from cache of my phone.

    In My iphone 5s,i have disabled automatic download from whatsapp app.So whichever images,video i feel is good i download them and then save them to my camera roll section.So i want to know how can i remove the images from cache of my phone which are downloaded and not saved,but they remain in cache.
    Even in some apps i have data which i want to remove,but cant find a way to remove them and they are in my cache eating up my memory.

    Try assigning Queen as the Album Artist on the compilations in iTunes on your computer.

  • How can I get an image from the screen? Like screen printer in PC to pasting after in word or other program.

    How can I get an image from the screen? Like screen printer in PC to pasting after in word or other program.

    If you do Cmd+Shift+3 you'll get a full screen image saved to your desktop as a jpg file.
    Also, you can use Cmd+Shift+4 and you'll get a cursor which you click+drag to draw a box. When you release the drag the boxed in area will be saved to the Desktop as a jpg file.

  • How can I manually attach images from my photo booth (imported into iPhoto) to emails? Auto function, in photo booth has my photos lying sideways?

    How can I manually attach images from my photo booth to iCloud emails?
    They are imported as 'events' into my iphoto library.
    Auto function, in photo booth has my photos lying sideways when placed in 'mail' emails?

    There are many, many ways to access your files in iPhoto:   You can use any Open / Attach / Browse dialogue. On the left there's a Media heading, your pics can be accessed there. Command-Click for selecting multiple pics.
    (Note the above illustration is not a Finder Window. It's the dialogue you get when you go File -> Open)
    You can access the Library from the New Message Window in Mail:
    There's a similar option in Outlook and many, many other apps.  If you use Apple's Mail, Entourage, AOL or Eudora you can email from within iPhoto.
    If you use a Cocoa-based Browser such as Safari, you can drag the pics from the iPhoto Window to the Attach window in the browser.
    If you want to access the files with iPhoto not running:
    For users of 10.6 and later:  You can download a free Services component from MacOSXAutomation  which will give you access to the iPhoto Library from your Services Menu.
    Using the Services Preference Pane you can even create a keyboard shortcut for it.
    For Users of 10.4 and 10.5 Create a Media Browser using Automator (takes about 10 seconds) or use this free utility Karelia iMedia Browser
    Other options include:
    Drag and Drop: Drag a photo from the iPhoto Window to the desktop, there iPhoto will make a full-sized copy of the pic.
    File -> Export: Select the files in the iPhoto Window and go File -> Export. The dialogue will give you various options, including altering the format, naming the files and changing the size. Again, producing a copy.
    Show File:  a. On iPhoto 09 and earlier:  Right- (or Control-) Click on a pic and in the resulting dialogue choose 'Show File'. A Finder window will pop open with the file already selected.    3.b.
    b: On iPhoto 11 and later: Select one of the affected photos in the iPhoto Window and go File -> Reveal in Finder -> Original. A Finder window will pop open with the file already selected.

  • How can I read pdf files from LabVIEW with different versions of Acrobat reader?

    How can I read pdf files from LabVIEW with different versions of Acrobat reader?
    I have made a LabVIEW program where I have possibility to read a PDF document.  When I made this LabVIEW program it was Acrobat Reader 5.0.5 that was installed on the PC. Lather when the Acrobat Reader was upgraded to version 6.0, there was an error when VI tries to launch the LabVIEW program. And Later again when we upgraded to Acrobat Reader 7.0.5 I must again do some changes and rebuild the EXE files again
    It isn't so very big job to do the changes in one single LabVIEW program, but we have built a lot of LabVIEW programs so this take time to due changes every time vi update Acrobat Reader. (We have build EXE files.)
    The job is to right click the ActiveX container and Click "Insert ActiveX Object", then I can brows the computer for the new version of acrobat Reader. After this I must rebuild all the "methods" in the Activex call to make the VI executable again.
    Is there a way to build LabVIEW program so I don't have to do this job every time we update Acrobat Reader?
    This LabVIEW program is written in LabVIEW 6.1, but I se the problem is the same in LabVIEW 8.2.
    Jan Inge Gustavsen
    Attachments:
    Show PDF-file - Adobe Reader 7-0-5 - LV61.vi ‏43 KB
    Read PDF file.jpg ‏201 KB
    Show PDF-file - Adobe Reader 5-0-5 - LV61.vi ‏42 KB

    hi there
    try the vi
    ..vi.lib\platform\browser.llb\Open Acrobat Document.vi
    it uses DDE or the command line to run an external application (e.g. Adobe Acrobat)
    Best regards
    chris
    CL(A)Dly bending G-Force with LabVIEW
    famous last words: "oh my god, it is full of stars!"

  • How can I read text files from LAN if I only know the hostname?

    I'm new in Java Developing, and dont know the written classes yet. I need help, how to do the following steps?
    <p>1. How can I read text files from LAN if I only know the hostname, or IP address?
    <p>2. How to read lines from text files without read all lines from the beginning of file, just seek to a position.
    (ex. how can I read the 120th line?)
    <p>Please help!
    <p>sorry for the bad english

    I'm new in Java Developing, and dont know the written classes yet. I need help, how to do the following steps?
    1. How can I read text files from LAN if I only know the hostname, or IP address?You need to know the URL of the file. You need to know the hostname, port, protocl and relative path.
    The hostname is server, not file.
    2. How to read lines from text files without read all lines from the beginning of file, just seek to a position.Use the seek() to get to a random byte.
    (ex. how can I read the 120th line?)The only way to find the 120th line is to read the first 120 lines. You can use other file formats to find the 120th line without reading the whole file but to need to be able to detremine where the 120th line is

  • How can i Read a book from my Mac (digital editions) to my iPad 2

    How can i Read a book from my Mac (in digital editions) to my iPad 2

    iPad's aren't supported by ADE.  Some folks have been able to use iTunes to
    do the transfers, and others have used Bluefire reader.
    ===================

  • HOW CAN I READ A BOOK FROM MY IPAD/IBOOK ONTO MY TV

    HOW CAN I READ A BOOK FROM MY IPAD/IBOOK ON MY TV SCREEN?

    Apple TV: How to use AirPlay Mirroring
    Troubleshooting AirPlay and AirPlay Mirroring
    OR
    You can use the Apple Digital AV Adapter or VGA Adapter to share the display of your iOS device to a compatible TV, projector, or other external display.

  • How can we read some bytes from every line of the file

    How can we read some bytes from the every line of the file moving on to the next line
    without using the read line

    Actualiy readLine() takes more execution time
    for reading a part of line if we can do so without
    readLine() we can save some time...Well, if you knew, beforehand, the length of each line, you could use RandomAccessFile and its seek method, but, since you don't, you would have to read the rest of the line character-by-character, checking to see if it is a newline, in order to place the "cursor" at the beginning of the next line in order to read the next few characters you want.
    So, as you can see, you will need to read the entire line anyway (and if you do it yourself you also have to do the checking yourself considering all three possible end-of-line sequences), so you just as well use readLine().
    Some people may suggest Scanner and it's nextLine() method, but that also needs to read the rest of line (as evidenced by the fact that it returns it), so that is no different than the readLine() (or read it yourself) solution.

  • How can i read a document from a scanner machine in java

    I am building a application and i want to read the document from the scanner
    how can i read a document from a scanner machine in java
    So pls help me on this issue

    Probably not via a network.
    http://www.javaworld.com/javaworld/jw-07-2002/jw-0726-twain.html

  • How can i read a stored picture in oracle Long Raw datatype? blob or clob?

    How can i read a stored picture in oracle Long Raw datatype? Like a blob or clob?....i am using jdk 1.3
    This is because...i tried to read it like a blob but i obtain a exception...about Type of column no valid......but the column exist....and it contains the long raw datatype of the pictures.....this is my code:
    import java.sql.*;
    import java.io.*;
    import java.util.*;
    import oracle.jdbc.driver.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.io.InputStream;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.io.OutputStream;
    import java.sql.Connection;
    import java.sql.Statement;
    import java.sql.ResultSet;
    import java.sql.DriverManager;
    import oracle.sql.BLOB;
    import oracle.sql.BLOB.*;
    import oracle.jdbc.driver.*;
    import java.sql.*;
    class rec_ima1
    public static void main(String h[])
    Connection con = null;
    Blob bl;
    final ImageIcon image1;
    JPanel photo;
    try
    Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
    con= DriverManager.getConnection("jdbc:oracle:thin:@123.3.12.213:1521:db_name","user","password");
    String query = "Select * from pictures where ID = '18840'";
    Statement stmt = con.createStatement();
    ResultSet rs = stmt.executeQuery( query );
    if (!rs.next())
    System.out.println("Empty Result Set");
    bl = rs.getBlob(5);
    if (bl == null) {
    System.out.println("Null Blob");
    return;
    InputStream is = bl.getBinaryStream();
    int imageLength = (int) bl.length();
    System.out.println(imageLength);
    System.out.println(bl.length());
    byte[] imageData = new byte [imageLength];
    is.read(imageData, 0, imageLength);
    image1 = new ImageIcon(imageData);
    photo = new JPanel() {
    public void paint(Graphics g){
    g.setColor(Color.lightGray);
    g.drawImage(image1.getImage(), 0, 0, this);
    } catch (Exception e) {
    e.printStackTrace();
    Now i tried using clob:
    import java.sql.*;
    import java.io.*;
    import java.util.*;
    import oracle.jdbc.driver.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.io.InputStream;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.io.OutputStream;
    import java.sql.Connection;
    import java.sql.Statement;
    import java.sql.ResultSet;
    import java.sql.DriverManager;
    import oracle.sql.CLOB;
    import oracle.sql.CLOB.*;
    import oracle.jdbc.driver.*;
    import java.sql.CallableStatement;
    class rec_ima4
    public static void main(String h[])
    Connection con = null;
    Clob cl;
    JPanel photo;
    try
    Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
    con= DriverManager.getConnection("jdbc:oracle:thin:@123.3.12.213:1521:db_name","user","password");
    con.setAutoCommit (false);
    String query = "Select * from pictures where ID = '18840'";
    Statement stmt = con.createStatement();
    ResultSet rs = stmt.executeQuery( query );
    while (rs.next()) {
    oracle.sql.CLOB clob = (CLOB) rs.getObject(5); //line 47
    } catch (Exception e) {
    e.printStackTrace();
    This is the runtime exception:
    java.lang.ClassCastException: [B
    at rec_ima4.main(rec_ima4.java:47)

    Thanks by answering to me......
    Well....i did that....but what is ImageIO?....
    I declared a ImageIcon imageIO, but this give me the following:
    rec_ima3.java:49: cannot resolve symbol
    symbol : class BufferedImage
    location: class rec_ima3
    BufferedImage bi = ImageIO.read(bInput);
    ^
    rec_ima3.java:49: cannot resolve symbol
    symbol : variable ImageIO
    location: class rec_ima3
    BufferedImage bi = ImageIO.read(bInput);
    ^
    What classes i have to import?.....what is ImageIO?
    Thanks

  • How can i save the data from the Oracle database to my local directory

    How can i save the data from the Oracle database to my local directory instead Of saving the data file to the Directory created on the Oracle Server ?
    I require to design the Procedure which will pull the data from various tables and needs to store the data in the Client's local directory.

    Since SQL*PLUS runs on the client, you can use SQL*PLUS to spool data to your local drive.
    You could also use the database to write a a specified drive where all users have access to (mapped network drive, e.g.). I wouldn't recommend doing it that way, but it is sometimes useful when the files are created in some nightly batch run.

  • How can I read books purchased from iBooks on my Mac?

    I'm completely new to the whole Apple world and have ran across this issue.  How can I read books, that I've purchased through iBooks on my iPad or iPhone, on my Mac?  Surely this is possible, but I just can figure out how Apple intends for us to do this.
    If someone could please help me out with this information I would appreciate it.

    Or I can just purchase them from a competitor such as Kindle and read them on my Mac
    Sure seems short sighted on Apple's part not to have this functionality.  This will drive my purchasing decisions to Kindle.
    I'm sure that there has been plenty of negative feedback already directed to Apple for this decision.  Does anyone know whether or not they have listened and if they have any plans to correct this issue?

Maybe you are looking for

  • Best Practices for new iMac

    I posted a few days ago re failing HDD on mid-2007 iMac. Long story short, took it into Apple store, Genius worked on it for 45 mins before decreeing it in need of new HDD. After considering the expenses of adding memory, new drive, hardware and inst

  • Re: Moved from O2 to BT, line speed halved.

    Did eactly the same thing it has taken 87 mins to register on the website and post this, web pages are so slow to download iplayer will not even load Speed test shows 6 mb speed so I am getting what I was promised!!!!!!! Not a happy customer Sorry to

  • Missing Font Warning in Pages

    I transferred a Word file from a PC and when I open it in Pages I get a Missing Font Warning. How can I find where the words or characters that use that missing font are, so I can change the font. Is there a way I can search for or highlight any word

  • Problem transfering Music to N73

    Hi, I have bought the N73 phone three days back. I am trying to transfer music to the phone through the Music Manager program via the cable. However, i get an error message each time i try to transfer an MP3 type files. I don't know why !!! The error

  • Reading masterdata in transformation.

    Does  'read master data' in transformation is preferable if we are using time dependent info Object as input? Will our output accurate?