How can i put a file into blob using jdbc !?

Hi
i tried to put a file into blob , but got a problem.....
My environment:windows 2000pro,JBuilder 5.0 enterprise,oracle 8.1.6,(not install oracle jdbc driver )
a part of program(my program is very uglily,if anyone want,later i paste it ba....~_~)
//Statement stmt2=null;
//Resultset rs2;
//opa1 is the blob data
void saveBlobTableToDisk(Connection con) {
try {
stmt2=con.createStatement();
sqlStr2="SELECT * FROM emp3 where id=1004";
rs2=stmt2.executeQuery(sqlStr2);
while (rs2.next()) {
Blob aBlob=rs2.getBlob("opa1");
i got the exception :
" null
java.lang.UnsupportedOperationException
     at sun.jdbc.odbc.JdbcOdbcResultSet.getBlob(JdbcOdbcResultSet.java:4174)
     at test3.Frame1.saveBlobTableToDisk(Frame1.java:48)
     at test3.Frame1.<init>(Frame1.java:26)
     at test3.Application1.<init>(Application1.java:5)
     at test3.Application1.main(Application1.java:8) "
and the windows pop up a messagebox said that(about) my memory "0x09af007f" could not read, error in javaw.exe .
Later i used (ResultSet)getBinaryStream() to solve it. but getBinaryStream() only return a InputStream,so that i can make blob to a file,but i can't make a file to blob using jdbc.....
I am very stupid that installing sun java, oracle jdbc driver etc....(because i must set a lot of thing such as classpath,java_home etc), Can i only use JBuilder to do that ?
Or i must install oracle jdbc driver ?
Thanks.
D.T.

My guess here is that Sun's JDBC-ODBC bridge doesn't handle the BLOB datatype. Most ODBC drivers don't support that datatype, so I wouldn't expect the bridge to.
Is there a reason that you can't use the Oracle driver?
Justin

Similar Messages

  • How can i put a file into blob(using sun.jdbc.odbc.JdbcOdbcDriver)

    Hi
    i tried to put a file into blob , but got a problem.....
    My environment:windows 2000pro,JBuilder 5.0 enterprise,oracle 8.1.6,(not install oracle jdbc driver )
    a part of program(my program is very uglily,if anyone want,later i paste it ba....~_~)
    //Statement stmt2=null;
    //Resultset rs2;
    //opa1 is the blob data
    void saveBlobTableToDisk(Connection con) {
    try {
    stmt2=con.createStatement();
    sqlStr2="SELECT * FROM emp3 where id=1004";
    rs2=stmt2.executeQuery(sqlStr2);
    while (rs2.next()) {
    Blob aBlob=rs2.getBlob("opa1");
    i got the exception :
    " null
    java.lang.UnsupportedOperationException
         at sun.jdbc.odbc.JdbcOdbcResultSet.getBlob(JdbcOdbcResultSet.java:4174)
         at test3.Frame1.saveBlobTableToDisk(Frame1.java:48)
         at test3.Frame1.<init>(Frame1.java:26)
         at test3.Application1.<init>(Application1.java:5)
         at test3.Application1.main(Application1.java:8) "
    and the windows pop up a messagebox said that(about) my memory "0x09af007f" could not read, error in javaw.exe .
    Later i used (ResultSet)getBinaryStream() to solve it. but getBinaryStream() only return a InputStream,so that i can make blob to a file,but i can't make a file to blob using jdbc.....
    I am very stupid that installing sun java, oracle jdbc driver etc....(because i must set a lot of thing such as classpath,java_home etc), Can i only use JBuilder to do that ?
    Or i must install oracle jdbc driver ?
    Thanks.

    My guess here is that Sun's JDBC-ODBC bridge doesn't handle the BLOB datatype. Most ODBC drivers don't support that datatype, so I wouldn't expect the bridge to.
    Is there a reason that you can't use the Oracle driver?
    Justin

  • How to insert an image file as blob using JDBC Statement

    Hi,
    I'm new on java.
    I want the code to insert an image file in Oracle database whose data type is blob.
    i want to use JDBC statement not the prepared statement.
    Please help me out.

    user8739226 wrote:
    thanks for the solution.
    I want to ask one thing
    let say i've created a method in a bean in which i'm passing three parameters.
    One is tablename as String, Second is Name of tablefields as Object, Third is Values as Object
    Like:
    public synchronized int insert(String table,Object[] fields, Object[] values)Ah now we're getting somewhere. I was trying to come up with a situation where using a regular Statement over PreparedStatement would be viable and came up with practically nothing.
    In the method body i'm accessing the table fields and values and combining them into the insert sql query.
    how can i do this using preparedstatment.
    how do i come to know here in this bean that this value is int or string or date at runtime to use setInt, setString, setdate or setBlob respectively.That's your problem. Bad design. You want to make some sort of universal insert method that can insert anything anywhere. But it doesn't really make sense, because whenever you're trying to insert something, you know exactly what you want to insert and where. You could use a PreparedStatement at that point (although encapsulate it in its own method). Now you're trying to create your own poorly designed framework over JDBC that doesn't solve problems, only increases them.
    Above was the only reason i saw, i was using statement instead of preparedstatment as statement was looking easy in this situation.
    please, give me the solution of above using preparedstatment.No, rather you should reconsider your design. What advantage does your insert() method give you over, let's say using a regular PreparedStatement. Granted, you can put your connection opening and other boilerplate code in the method. But if that's your only problem, then your insert method isn't gonna be much use. You could always switch to JPA for example and work with that.

  • How can i put back files that were accidentally put into trash

    How can i put back files that were accidentally put into trash.  I'm using Mountain Lion on my Mac Book Pro

    command Z if it was the last thing you did.
    Control (right) click on any item in the trash folder>> Put Back

  • How can i put Jar Files in Java Runtime.?

    HI,
    how can i put jar files in JRE so that they are accessible every where.? is there some way.?
    Regards,
    AA

    Closest you could get to this I think is to explode all your jars into the same parent directory. Then if you put that directory on the classpath, you should be able to access all classes in all jar files

  • I shot video on a Panasonic P2 and I'm trying to import the MXF files to Final Cut Pro but when I try to import, the only thing that imports is a blurry image of each clip. There's no audio and no video...how can I import MXF files into Final Cut Pro?

    I shot video on a Panasonic P2 and I'm trying to import the MXF files to Final Cut Pro but when I try to import, the only thing that imports is a blurry image of each clip. There's no audio and no video...how can I import MXF files into Final Cut Pro?

    at the end, you say "import preferences", which program are you describing?
    So im safer using footage that is remotely being pulled from iphoto...
    vs
    using footage that is imported into FCP from imovie?
    Is there anything i can do in fcp to make this footage more reliable or safer or more stable as i pull remotely from iphoto?
    All the footage, and all the libraries to all programs, or on a new pegasus 12tb raid 5 setup fyi.

  • How can i put one scene into JPanel of the swing?

    how can i put one scene into JPanel of the swing?

    980571 wrote:
    ty for the information but i have a problen with JFXpanel when i try to into a panel it doesnt display insideSorry to hear that. If you want assistance with the code, feel free to post the relevant parts of it. Make sure to use \ tags when you do.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • How can I sync text files into iPhone?

    How can I sync text files into iPhone? like doc. txt. for reading or editing

    The native iPhone OS doesn't allow that. I think there are several solutions to this, some of which may be against the AT&T or Apple rules. One legitimate solution is The Missing Sync for iPhone by mark/space (http://www.markspace.com).
    Before I had an iPhone, I owned a copy of The Missing Sync for Windows Mobile. It was a pretty decent app. In my opinion, though, their app for the iPhone is NOT worth the price ($40 new, $25 for a cross-grade).
    Also, check the App Store (if you have 2.0 software)--there may be an app that does this, probably for a lot less $.

  • How can I put my bookmarks into the sequence I want, alphabetical or otherwise?

    How can I put my bookmarks into the sequence I want, alphabetical or otherwise?

    http://kb.mozillazine.org/Sorting_bookmarks_alphabetically <br />
    http://kb.mozillazine.org/Sorting_and_rearranging_bookmarks_-_Firefox

  • How can i put below  table into internalt table

    how can i put below  table into internalt table and want to add both internal table into 3rd internal table.
    SELECT  * FROM J_1IEXCHDR  WHERE STATUS = 'P'.
    WRITE: / J_1IEXCHDR-LIFNR,
              J_1IEXCHDR-DOCNO,
              J_1IEXCHDR-EXYEAR,
              J_1IEXCHDR-BUDAT.
    SELECT * FROM J_1IEXCDTL  WHERE TRNTYP = J_1IEXCHDR-TRNTYP
                              AND DOCYR  = J_1IEXCHDR-DOCYR
                              AND DOCNO  = J_1IEXCHDR-DOCNO.
       WRITE: / J_1IEXCDTL-EXBAS,
                J_1IEXCDTL-EXBED,
                J_1IEXCDTL-RDOC1,
                J_1IEXCDTL-ECS.
    ENDSELECT.
    ENDSELECT.
    please help
    thanks in adavaced.

    hi laxman,
    use for all entries and get the required data.
    SELECT * FROM J_1IEXCHDR into table itab1 WHERE STATUS = 'P'.
    if not itab1[] is initial.
    SELECT * FROM J_1IEXCDTL into table itab2 for all entries in itab1 WHERE TRNTYP = itab1-TRNTYP
    AND DOCYR = itab1-DOCYR
    AND DOCNO = itab1-DOCNO.
    endif.
    so itab2 will have the common records...This will solve ur problem..
    also u can do other method declare an final internal table with the common fields of the two internal table.
    then after getting data in itab1 and itab2.
    loop at itab1.
    move-corresponding itab1 to itab3.
    read table itab2 with key <give the fields> = ......
    if sy-subrc eq 0.
    move-corresponding itab2 to itab3.
    endif.
    append itab3.
    endloop.
    Regards,
    nagaraj

  • How can I import vob files into imovie 09?

    how can I import vob files into imovie 09? i have some home movies on dvd that i want to edit.

    You might want to look at this one too.  Very easy to use and it doesn't require the Apple MPEG-2 playback component.
    http://www.dvdxdv.com/NewFolderLookSite/Products/DVDxDV.overview.htm

  • How can i import mpeg files into iMovie?

    how can i import mpeg files into iMovie?

    Where are your MPEG stored?
    I have hundreds of old MPEGs stored in my nexternal drive, but unfortunatly i was not able import them into iMovie. I did the following trick: I created a new set of a folder and subfolder and called it "Virtual_CAM/DCIM" and saved it on my desktop. Then went to Disk Utilities>File Menue>New>Disk Image from Folder. Then selected the folder on my desktop and clicked enter. I moved the .dmg file to my external (or just keep it on your desktop). I clicked on the .dmg file. It shoud be visible on the Finder. Open your Imovie and import as you do from your camera.

  • How can I put download file back on dock?

    How can I put download file back on dock?

    Welcome to Apple Support Communities
    If you want to put a folder in the Dock, open a Finder window and drag the folder to the right part of the Dock. In this case, you want to put the Downloads folder in the Dock again, so open a Finder window and drag Downloads from the Finder sidebar to the right part of the Dock

  • How can i put some file (xml) in root apk?

    how can i put some file (xml) in root apk?
    I put fileA in flash builder mobile project.
    build apk.
    fileA  →  "main.apk/assets/fileA" . 
    expect → "main.apk/fileA" .
    PS: view apk by Winrar.
    I have a Demo Android java project.
    It uses armeabi/libcasdkjni.so .
    build apk

    +assets
    +lib
    +META-INF
    +res
    -AndroidManifest.xml
    -classes.dex
    -CopyrightDeclaration.xml
    -mmiap.xml                                                       ←   fileA
    -resources.arsc
    -VERSION
    i build an ANE include armeabi/libcasdkjni.so.
    apk is missing mmiap.xml

    all files will be embed in "assests"(floder in apk ,which includes swf file) in that way.
    build apk

    +assets                                ←         "assets"
    +lib
    +META-INF
    +res
    -AndroidManifest.xml
    -classes.dex
    -CopyrightDeclaration.xml
    -mmiap.xml                                                       ←   fileA
    -resources.arsc
    -VERSION

  • How can i put my files that are in my ipad to my computer

    how can i put my files that are in my ipad to my computer, because i deled all them from my computer, but they are in my ipad.what am i supposed to do?

    What kind of files are they and what apps are you using on the iPad with these files?

Maybe you are looking for

  • Import sony minidv to imovie?

    I am trying to connect my Sony DCR-HC40 miniDV to my Macbook, but I am getting nothing (through firewire). I'm looking for a way to troubleshoot the problem. As with a previous post, my camera is registering "DV in" but I cannot find anything on the

  • How to write an array and a scalar to file?

    I would like to write my data to a file but am having trouble approaching the problem. In the file I would like to write both the x and y values of my data points in two columns, however, the y data is in an array and the x data is made up of 3 piece

  • GDS without ECC at backend

    Hi GDS experts, 1. We are planning to implement SAP GDS solution but without ECC at backend. Is it possible to do that? 2. Do you have the import and export XSD structures that we can use to import and syndicate data to and from GDS repository? Regar

  • Portal Activity Data Collector -- Multiple directories

    We are using the Portal Activity Data Collector and want to know if Sol Man 7 EHP 1 will pick up the files from more than one location or do we still have to put them into a central directory to be analyzed? Thanks for your assistance! --  Jackie McC

  • I have a Mac. Can I download Thunderbird to a disk for a friend who has Windows?

    My friend who has Windows asked me to download Thunderbird on a disk for her. She can't download it herself because she has dial-up. I don't have Windows installed on my Mac.