Blob to byte[] detach failure

Hi,
I'm unable to detach a byte array using Kodo 3.3.4 and PostgreSQL 8.0. The
byte array in the detached object is always empty despite there being
bytes in the database table for the correspond column/row. Other fields
are detached correctly.
In my JDO file -
<field name="image">
<!-- Map image to BLOB field -->
<extension vendor-name="kodo" key="jdbc-field-map-name" value="blob">
<extension vendor-name="kodo" key="column" value="image"/>
</extension>
</field>
This correctly creates a column of named 'image' of type 'bytea' in the
table.
This issue isn't listed in the know issues for PostgresQL - can anybody
else confirm they have this working with this database? I see there was a
similar problem with mySQL posted here, but then that issue wasn't
documented either.
Thanks,
Andy.

byte[] fields aren't in the default fetch group by default, and
detachment only occurs on fields in the DFG. Both of these options
(whether the field is in the DFG, and whether detachment works on DFG
fields or uses some other criteria), are configurable. I assume you
know how to control DFG settings; the documentation on detachment is here:
http://www.solarmetric.com/Software/Documentation/latest/docs/ref_guide_remote.html#ref_guide_detach_graph

Similar Messages

  • POJO - Pictures, Blob ot byte[]

    Hi All,
    the POJO Reporting works fine but
    How can i include a picture into my Report ??
    If i move my object (with a Blob and byte[]) into myReport.rpt the Blob and the byte[] does not become available for reporting.
    What is wrong ??
    Thanks for Your help
    René
    My Object:
    public class RhuPlakatData {
    private String text11;
    private Blob blob1;
    private byte[] bytes;
    public byte[] getBytes() {
    return bytes;
    public void setBytes(byte[] bytes) {
    this.bytes = bytes;
    public String getText11() {
    return text11;
    public void setText11(String text11) {
    this.text11 = text11;
    public Blob getBlob1() {
    return blob1;
    public void setBlob1(Blob blob1) {
    this.blob1 = blob1;

    Hi James
    Unfortunately, I found no solution.
    Did You found a solution??
    Thanks for Your help
    Greetings
    René

  • Exception getting blob to byte[]

    Hy guys,
    I 've a problem with my java application.
    I use hibernate to interact with a derby database.
    I stored a image into blob field (and no problem).
    When I try to get blob to array of byte I've this exception:
    java.sql.SQLException: You cannot invoke other java.sql.Clob/java.sql.Blob methods after calling the free() method or after the Blob/Clob's transaction has been committed or rolled back.To get blob I did
    Blob cThumnb = ((Allegato) cAllegati.get(i)).getThumb();
    byte[] cPrev = toByteArray(cThumnb);where
    private byte[] toByteArray(Blob fromBlob) {
            ByteArrayOutputStream baos = new ByteArrayOutputStream();
            try {
                return toByteArrayImpl(fromBlob, baos);
            catch (SQLException e)
                throw new RuntimeException(e);
            catch (IOException e)
                throw new RuntimeException(e);
            finally
                if (baos != null)
                    try
                        baos.close();
                    catch (IOException ex)
        private byte[] toByteArrayImpl(Blob fromBlob, ByteArrayOutputStream baos)  throws SQLException, IOException
            byte[] buf = new byte[4000];
            InputStream is = fromBlob.getBinaryStream();
            try
                for (;;)
                    int dataSize = is.read(buf);
                    if (dataSize == -1)     break;
                    baos.write(buf, 0, dataSize);
            catch(IOException ex)
                    throw ex;
           finally
                if (is != null)
                    try
                        is.close();
                    catch (IOException ex)
                    return  buf;// baos.toByteArray();
        }Could you help me?
    I set also autocommit to false,
    Thanks,
    Regards

    EJP wrote:
    So could you cite some references that show, in general, that one normally needs to process blobs as streams?The design. The name, which is an acroynm for Binary Large Object. The fact that they have a stream interface, like files and sockets.The idiom for loading does not require nor even recommend that one must process as a stream.
    And most of the time I do not process files nor sockets via streaming methodologies. I load them entirely, then process them.
    Actually for direct socket usage, excluding protocols like FTP, I don't believe I have ever streamed processing because in message based protocols the messages are very small.
    Presumably because the OP has one reference to 'thumb' as in thumbnail view?From the OP's first post: 'I stored a image into blob field'.I see. I have stored images in databases before. Excluding storage of medical media files they were all processed in memory because all were rather small.
    Certainly cases where one does in fact want to read an entire file into memory, before one starts processing it.Can't think of any, but in any case if you are able to process it as a stream you are wasting both time and space by not doing so.If I have any data that is in fact "large" I will keep that in mind. But, for example, I can't see processing a configuration file that consists of a couple hundred bytes via stream processing just because files allow for the possibility that one can process a large file.

  • BLOB to byte[] mapping

    Hi,
    In my table, one of the columns is of type BLOB. When I generate Java objects out of the database, the type of this column becomes java.sql.Blob. This seems to be the default mapping. I want it to be of type byte[].
    How do I configure Toplink Workbench to map it always as byte[]?

    Either value in the object model is valid. You can modify the generated class to hold a byte[].
    If you are using the Oracle thin JDBC driver you should map the byte[] attribute as a TypeConversionMapping and select the type to be java.sql.BLOB.
    Doug

  • Please help, I need to read blob and output in bytes from wwv_flow_files.

    Hi all,
    I am having a requirement to read a blob stored in the oracle table and convert it into bytes. I am loading this table (wwv_flow_files) with APEX.
    The code under page 1 is as follows:
    DECLARE
    z number;
    y varchar2(4000);
    x varchar2(400);
    b blob;
    BEGIN
    select filename,blob_content into x ,b from APEX_APPLICATION_files where name =:P1_FILE_NAME;
    select length(convertBlobToBytes(b)) into z from dual;
    :P1_RESULT := z;
    end;
    Java code is as follows:
    import java.io.*;
    import java.sql.Blob;
    public class convertBlob {
    * @param blob
    * @return
    public static byte[] convertBlobToBytes(Blob blob) {
    if (blob==null) return null;
    try {
    InputStream in = blob.getBinaryStream();
    int len = (int) blob.length(); //read as long
    long pos = 1; //indexing starts from 1
    byte[] bytes = blob.getBytes(pos, len);
    in.close();
    return bytes;
    catch (Exception e) {
    System.out.println(e.getMessage());
    return null;
    PL/SQL wrapper is as follows:
    CREATE OR REPLACE FUNCTION convertBlobToBytes(p1 IN BLOB) RETURN LONG RAW AUTHID CURRENT_USER AS LANGUAGE JAVA NAME 'convertBlob.convertBlobToBytes(java.sql.Blob) return byte[]';
    I loaded this java class and pl/sql wrapper into the database using JDEVELOPER.
    But I am getting the length of the file, as twice the size.
    For example, When I run the program which reads the file returns the length of the file as a byte array, the length is 819.
    When I pass the same file as a blob from apex, to the java program that converts blob to bytes, the length of the file is 1638.
    And hence I am getting wrong results, further in the process.
    Can you please help me? Any help is appreciated.
    rgds,
    Suma.

    The example on this page is showing how to read a blob in portions you determine yourself:
    http://apex.oracle.com/pls/otn/f?p=31517:91
    Denes Kubicek
    http://deneskubicek.blogspot.com/
    http://www.opal-consulting.de/training
    http://apex.oracle.com/pls/otn/f?p=31517:1
    -------------------------------------------------------------------

  • Plesae help- needing to read a blob from db into bytes[]

    Hi all,
    I am having a requirement to read a blob stored in the oracle table and convert it into bytes. I am loading this table (wwv_flow_files) with APEX.
    The code under page 1 is as follows:
    DECLARE
    z number;
    y varchar2(4000);
    x varchar2(400);
    b blob;
    BEGIN
    select filename,blob_content into x ,b from APEX_APPLICATION_files where name =:P1_FILE_NAME;
    select length(convertBlobToBytes(b)) into z from dual;
    :P1_RESULT := z;
    end;
    Java code is as follows:
    import java.io.*;
    import java.sql.Blob;
    public class convertBlob {
    * @param blob
    * @return
    public static byte[] convertBlobToBytes(Blob blob) {
         if (blob==null) return null;
         try {
         InputStream in = blob.getBinaryStream();
         int len = (int) blob.length(); //read as long     
    long pos = 1; //indexing starts from 1
         byte[] bytes = blob.getBytes(pos, len);           
    in.close();
         return bytes;     
    catch (Exception e) {
         System.out.println(e.getMessage());
         return null;
    PL/SQL wrapper is as follows:
    CREATE OR REPLACE FUNCTION convertBlobToBytes(p1 IN BLOB) RETURN LONG RAW AUTHID CURRENT_USER AS LANGUAGE JAVA NAME 'convertBlob.convertBlobToBytes(java.sql.Blob) return byte[]';
    I loaded this java class and pl/sql wrapper into the database using JDEVELOPER.
    But I am getting the length of the file, as twice the size.
    For example, When I run the program which reads the file returns the length of the file as a byte array, the length is 819.
    When I pass the same file as a blob from apex, to the java program that converts blob to bytes, the length of the file is 1638.
    And hence I am getting wrong results, further in the process.
    Can you please help me? Any help is appreciated.
    rgds,
    Suma.

    Hi all,
    Can any of you please help me out?
    rgds,
    Suma.

  • Should I be able to update a Blob via a ResultSet? (11g driver exception)

    This code fails at the last line:
    stmt = conn.createStatement();
    String tableName = "TBL_esun01_PPP";
    stmt.execute("drop table TBL_esun01_PPP");
    stmt.execute("create table TBL_esun01_PPP (sid int not null primary key, blob_col blob)");
    stmt.close();
    //insert test data
    String blobContent = "WLS JDBC4 test for blob.";
    String blobContentUpdate = "WLS JDBC4 test for UpdateBlob. [Updated]";
    ByteArrayInputStream inputStream = new ByteArrayInputStream(blobContent.getBytes());
    ByteArrayInputStream inputStreamUpdate = new ByteArrayInputStream(blobContentUpdate.getByte
    s());
    String insertSql = "INSERT INTO " + tableName + " VALUES (?, ?)";
    PreparedStatement pstmt = conn.prepareStatement(insertSql);
    int key = 1;
    pstmt.setInt(1, key);
    pstmt.setBlob(2, inputStream);
    pstmt.execute();
    pstmt.close();
    inputStream.close();
    //update data
    String querySql1 = "SELECT sid FROM " + tableName;
    String querySql2 = "SELECT sid, blob_col FROM " + tableName;
    Statement stmt = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
    ResultSet.CONCUR_UPDATABLE);
    // we can get updatable resultset in the same way without lob object.
    // following updating can succeed.
    System.out.println("Get updatable resultset using: "+querySql1);
    ResultSet rs = stmt.executeQuery(querySql1);
    rs.next();
    rs.updateInt(1, 2);
    rs.updateRow();
    rs.close();
    inputStreamUpdate.close();
    System.out.println("Get updatable resultset using: "+querySql2);
    try {// failed to get updatable resultset
    rs = stmt.executeQuery(querySql2);
    rs.next();
    rs.updateBlob(2, inputStreamUpdate); // Fails here...
    The driver is 11.1.0.6.0-Production
    The DBMS is Oracle Database 11g Release 11.1.0.0.0 - Production
    Get updatable resultset using: SELECT sid FROM TBL_esun01_PPP
    Get updatable resultset using: SELECT sid, blob_col FROM TBL_esun01_PPP
    We can not get updatable Resultset. Exception message:
    java.sql.SQLException: Invalid operation for read only resultset: updateBlob
    at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:70)
    at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:112)
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:173)
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:229)
    at oracle.jdbc.driver.BaseResultSet.updateBlob(BaseResultSet.java:506)
    at TestUpdatableRS.test(TestUpdatableRS.java:84)
    at TestUpdatableRS.main(TestUpdatableRS.java:112)
    thanks,
    Joe

    Joe,
    a) I could not find updateBlob(int, java.io.InputStream). It is updateBlob(int, java.sql.Blob).
    b) I tried the below test and it worked fine, I am using the latest drivers.
    CREATE TABLE BLOB_TABLE (C1 NUMBER, C2 BLOB);
    INSERT INTO BLOB_TABLE VALUES(55, '101011');
    public static void test2(Connection conn) throws SQLException {
    System.out.println("test -");
    PreparedStatement pstmt = null;
    ResultSet rs = null;
    try {
    String query = "select c1, c2 FROM blob_table";
    pstmt = conn.prepareStatement(query, ResultSet.TYPE_SCROLL_INSENSITIVE,
    ResultSet.CONCUR_UPDATABLE);
    rs = pstmt.executeQuery();
    SQLWarning x = pstmt.getWarnings();
    if (x != null)
    System.out.println(x.getMessage());
    x = rs.getWarnings();
    if (x != null)
    System.out.println(x.getMessage());
    BLOB blob = BLOB.createTemporary(conn, true, BLOB.DURATION_SESSION);
    byte[] b = new byte[50];
    java.util.Arrays.fill(b, (byte) 53);
    blob.putBytes(1L, b);
    if (rs.next()) {
    rs.updateInt(1, 88);
    rs.updateBlob(2, blob);
    rs.updateRow();
    x = rs.getWarnings();
    if (x != null) {
    System.out.println(x.getMessage());
    } catch (SQLException ea) {
    System.out.println(ea);
    } finally {
    if (rs != null) {
    rs.close();
    if (pstmt != null) {
    pstmt.close();
    System.out.println("test - done");
    } // end of test2(Connection);
    ==
    Ashok

  • BLOB insert behavior with thin driver using standard JDBC2.0 and ORACLE-JDBC2.0API

    We have a problem with a BLOB insert to an oracle 8.1.7 DB using Oracle 8.1.7 JDBC thin driver.We get socket read/write error after inserting 32k of data using the standard JDBC2.0 API but using the Oracle JDBC2.0API (using OracleResultSet) it goes fine. We have a requirement to use the standard JDBC2.0 so that our code works with multiple database vendors. Is there another way to get in the blob data with standard JDBC API & using thin driver...?
    thanks,
    Madhu
    Here is my sample test program that does both standard & oracle specific JDBC Blob test insert.
    import java.sql.*;
    import java.io.*;
    import oracle.sql.BLOB;
    import oracle.jdbc.driver.OracleResultSet;
    public class testBLOB {
    //trying to insert a huge file to a BLOB
    static String fileName = "/kernel/genunix";
    public static void main(String[] args) {
    String driverName = "oracle.jdbc.driver.OracleDriver";
    String dbURL = "jdbc:oracle:thin:@localhost:1521:test"; //thin driver
    String user = "BlobTest";
    String passwd = "BlobTest";
    Connection con=null;
    try {
    Class.forName(driverName);
    con=DriverManager.getConnection(dbURL, user,passwd);
    catch (Exception e) {
    e.printStackTrace();
    close(con);
    int i = 0;
    while (i < args.length) {
    if (args.equals("-f"))
    fileName = args[++i];
    i++;
    System.out.println("The file being Stored is: "+fileName);
    createTable(con);
    insertUsingOracleAPI(con);
    insertUsingJDBC20API(con);
    //readDB(con);
    static String getFileName() {
    return fileName;
    public static void close(Connection con) {
    try {
    if (con != null) {
    con.close();
    catch (Exception e) {
    System.exit(-1);
    public static void createTable(Connection con) {
    Statement stmt ;
    try {
    stmt = con.createStatement();
    stmt.execute("DROP TABLE basic_blob_table");
    stmt.close();
    catch (SQLException sqlEx) {
    System.out.println("Dropped the Table");
    try {
    stmt = con.createStatement();
    stmt.execute("CREATE TABLE basic_blob_table ( x varchar2(30), b blob)");
    stmt.close();
    catch (SQLException sqlEx) {
    sqlEx.printStackTrace();
    close(con);
    System.out.println("Created the Table");
    public static void insertUsingOracleAPI(Connection con) {
    OutputStream os = null;
    Statement stmt = null;
    ResultSet rs = null;
    FileInputStream is = null;
    try {
    con.setAutoCommit(false);
    stmt = con.createStatement();
    stmt.execute("INSERT INTO basic_blob_table VALUES( 'OracleAPI', empty_blob())");
    System.out.println("Inserted the dummy Row");
    rs = stmt.executeQuery("Select * from basic_blob_table where x='OracleAPI'");
    if (rs != null && rs.next()) {
    BLOB blob = ((OracleResultSet)rs).getBLOB(2);
    File file = new File(getFileName());
    is = new FileInputStream(file);
    os = blob.getBinaryOutputStream();
    byte[] chunk = new byte[1024];
    int length = -1;
    while((length = is.read(chunk)) != -1)
    os.write(chunk, 0,length);
    System.out.println("Inserted the File " + getFileName() );
    catch (Exception e) {
    e.printStackTrace();
    finally {
    try {
    if (os != null) {
    os.flush();
    os.close();
    if (is != null)
    is.close();
    stmt.close();
    con.commit();
    con.setAutoCommit(true);
    catch (Exception e) {}
    public static void insertUsingJDBC20API(Connection con) {
    PreparedStatement stmt = null;
    FileInputStream is = null;
    try {
    stmt = con.prepareStatement("INSERT INTO basic_blob_table VALUES(?,?)");
    File file = new File(getFileName());
    is = new FileInputStream(file);
    stmt.setString(1,"JDBC20API");
    stmt.setBinaryStream(2,is,(int)file.length());
    stmt.executeUpdate();
    catch (Exception e) {
    e.printStackTrace();
    finally {
    try {
    if (is != null)
    is.close();
    stmt.close();
    catch (Exception e) {}
    null

    Thanks for the response.
    I understand what you are saying...
    that readers don't block writers in Oracle (the same is true in SQL Server 2000).
    However, I don't see how my test case is working correctly with Oracle (the exact same code acting as I'm thinking it should with SQL Server, but I still think it is acting incorrectly with Oracle).
    I have transaction A do this:
    update <table> set <column2>=<value> where <column1>='1'
    then I use Thread.sleep() to make that program hang around for a few minutes.
    Meanwhile I sneak off and start another program which begins transaction B. I have transaction B do this:
    select * from <table> where <column1>='1'
    and the read works immediately (no blocking... just as you have said) however, transaction A is still sleeping, it has not called commit() or rollback() yet.
    So what if transaction A were to call rollback(), the value read by transaction B would be incorrect wouldn't it ?
    Both A and B use setAutoCommit(false) to start their transactions, and then call setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED).
    Isn't that supposed to guarantee that a reader can only read what is committed ?
    And if a row is in "flux"... in the process of having one or more values changed, then the database cannot say what the value will be ?
    I can almost see what you are saying.
    In letting the reader have what it wants without making it wait, I suppose it could be said that Oracle is holding true to the "only let committed data be read"
    So if that's it, then what if I want the blocking ?
    I want an entire row to be locked until whoever it in the middle of updating, adding, or removing it has finished.
    Do you know if that can be done with Oracle ? And how ?
    Thanks again for helping me.

  • Error inserting BLOBs in OC4J 9.0.2.1

    The following snippet of code works in oc4j 9.0.2.0.0 but not in OC4J 9.0.2.1 Any ideas why?
    Thanks,
    Rajiv
    FileInputStream in = new FileInputStream(file.getPath());
    conn.setAutoCommit(false);
    ps = conn.prepareStatement("SELECT blob_info FROM trx_blob WHERE trx_blob_id = ? FOR UPDATE");
    ps.setInt(1, blobID);
    rs = ps.executeQuery();
    rs.next();
    BLOB blob = ((OracleResultSet) rs).getBLOB(1);
    OutputStream outStream = blob.getBinaryOutputStream();
    int size = blob.getBufferSize();
    byte[] buffer = new byte[size];
    int length = -1;
    while ((length = in.read(buffer)) != -1) {
    outStream.write(buffer, 0, length);
    outStream.close();
    in.close();
    conn.commit();
    The error I get is java.sql.SQLException: ORA-01002: fetch out of seqence

    Rajiv -- This looks like bug 2541604. Please ask your support representative for a patch.
    Thanks -- Jeff

  • Using JSP/Servlet to write Word Document to BLOB

    Hi
    I need some help pls
    When I use a normal class with a main method, it loads the word document into a blob and I can read this 100%.Stunning.
    With a JSP/Servlet I cannot get the document out again. The "format" seems to be lost.
    Any ideas,help greatly appreciated:
    Here is the Main class that works:
    package mypackage1;
    import java.io.OutputStream;
    import java.sql.DriverManager;
    import java.sql.PreparedStatement;
    import java.sql.ResultSet;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.PrintWriter;
    import java.io.IOException;
    import java.io.BufferedReader;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileReader;
    import java.io.FileNotFoundException;
    import java.io.Writer;
    import java.sql.Connection;
    import oracle.jdbc.*;
    import oracle.jdbc.OracleResultSet;
    import oracle.sql.BLOB;
    import org.apache.log4j.Logger;
    import Util_Connect.DataBase;
    public class TestLOB
    //static final Logger logger = Logger.getLogger("test");
    public TestLOB()
    public static void main(String args[])
    TestLOB testLOB = new TestLOB();
    testLOB.TestLOBInsert("c:\\my_data\\callcenterpilot.doc");
    public void TestLOBInsert(String fileName)
    Connection conn = getConnection("wizard");
    BLOB blob = null;
    try
    conn.setAutoCommit(false);
    String cmd = "SELECT * FROM so_cs.testlob WHERE docno = 1 FOR UPDATE";
    PreparedStatement pstmt = conn.prepareStatement(cmd);
    ResultSet rset = pstmt.executeQuery(cmd);
    rset.next();
    blob = ((OracleResultSet)rset).getBLOB(2);
    File binaryFile = new File(fileName);
    System.out.println("Document length = " + binaryFile.length());
    FileInputStream instream = new FileInputStream(binaryFile);
    OutputStream outstream = blob.getBinaryOutputStream();
    int size = blob.getBufferSize();
    byte[] buffer = new byte[size];
    int length = -1;
    while ((length = instream.read(buffer)) != -1)
    outstream.write(buffer, 0, length);
    instream.close();
    outstream.close();
    conn.commit();
    closeConnection(conn);
    catch (Exception ex)
    System.out.println("Error =- > "+ex.toString());
    private Connection getConnection(String dataBase)
    Connection conn = null;
    try
    DriverManager.registerDriver(new OracleDriver());
    conn = DriverManager.getConnection("jdbc:oracle:thin:@oraclu5:1600:dwz110","so_cs","so_cs");
    catch (Exception ex)
    System.out.println("Error getting conn"+ex.toString());
    return conn;
    private void closeConnection(Connection conn)
    if (conn != null)
    try
    conn.close();
    catch (Exception se)
    System.out.println("Error closing connection in get last imei"+se.toString());
    Works fine:
    Here is the display servlet: Works when main class inserts file
    package mypackage1;
    import java.io.InputStream;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.PrintWriter;
    import java.io.IOException;
    import java.io.OutputStream;
    import java.sql.DriverManager;
    import java.sql.PreparedStatement;
    import java.sql.ResultSet;
    import java.io.BufferedReader;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileReader;
    import java.io.FileNotFoundException;
    import java.io.Writer;
    import java.sql.Connection;
    import oracle.jdbc.*;
    import oracle.jdbc.OracleResultSet;
    import oracle.sql.BLOB;
    import org.apache.log4j.Logger;
    import Util_Connect.DataBase;
    public class DisplayLOB extends HttpServlet
    private static final String CONTENT_TYPE = "text/html; charset=windows-1252";
    static final Logger logger = Logger.getLogger(DisplayLOB.class);
    public void init(ServletConfig config) throws ServletException
    super.init(config);
    public void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
    //response.setContentType(CONTENT_TYPE);
    //PrintWriter out = response.getWriter();
    Connection conn = null;
    PreparedStatement pstmt = null;
    try
    conn = getConnection("wizard");
    //out.println("<html>");
    //out.println("<head><title>DisplayLOB</title></head>");
    //out.println("<body>");
    //out.println("<p>The servlet has received a POST. This is the reply.</p>");
    InputStream is=null;
    oracle.sql.BLOB blob=null;
    response.setContentType("application/msword");
    //response.setContentType("audio/mpeg");
    OutputStream os = response.getOutputStream();
    String term = "1";
    String query = "SELECT docdetail FROM testlob WHERE docno = 1";
    pstmt = conn.prepareStatement(query);
    ResultSet rs = pstmt.executeQuery();
    while (rs.next())
    blob=((OracleResultSet)rs).getBLOB(1);
    is=blob.getBinaryStream();
    int pos=0;
    int length=0;
    byte[] b = new byte[blob.getChunkSize()];
    while((length=is.read(b))!= -1)
    pos+=length;
    os.write(b);
    }//try
    catch (Exception se)
    se.printStackTrace();
    finally
    try
    pstmt.close();
    catch (Exception ex)
    System.out.println("Error closing pstmt "+ex.toString());
    //out.println("</body></html>");
    //out.close();
    private Connection getConnection(String dataBase)
    Connection conn = null;
    try
    conn = DataBase.getPoolConnection(dataBase);
    catch (Exception se)
    logger.fatal("Error getting connection: ",se);
    return conn;
    private void closeConnection(Connection conn)
    if (conn != null)
    try
    conn.close();
    catch (Exception se)
    logger.error("Error closing connection in get last imei",se);
    Here is JSP/Servlet
    <%@ page import="org.apache.log4j.*"%>
    <%@ page contentType="text/html; charset=ISO-8859-1" %>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <title>untitled</title>
    <title>Wizard SMS Interface</title>
    <link rel='stylesheet' type='text/css' href='main1.css'>
    <script language='JavaScript' src='copyright.js'></script>
    </head>
    <pre>
    <%
    //HTTP 1.1
    response.setHeader("Cache-Control","no-cache");
    //HTTP 1.0
    response.setHeader("Pragma","no-cache");
    //prevents caching at the proxy server
    response.setDateHeader ("Expires", 0);
    Logger logger = Logger.getLogger("co.za.mtn.wizard.administration.admin01.jsp");
    %>
    </pre>
    <body>
    <FORM ACTION="/WizardAdministration/uploadfile"
    METHOD="POST"
    ENCTYPE="multipart/form-data">
    <INPUT TYPE="FILE" NAME="example">
    <INPUT TYPE="SUBMIT" NAME="button" VALUE="Upload">
    </FORM>
    </body>
    </html>
    <font> <b>Copyright &copy;
    <script>
    var LMDate = new Date( document.lastModified );
    year = LMDate.getYear();
    document.write(display(year));
    </script>
    Mobile Telephone Networks.
    <p align="left"><i><b><font face="Georgia, Times New Roman, Times, serif" size="1"></font></b></i></p>
    package co.za.mtn.wizard.admin;
    import java.io.InputStream;
    import java.util.Enumeration;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.PrintWriter;
    import java.io.IOException;
    import java.io.OutputStream;
    import java.sql.PreparedStatement;
    import java.sql.ResultSet;
    import java.io.BufferedReader;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileReader;
    import java.io.FileNotFoundException;
    import java.io.Writer;
    import java.sql.Connection;
    import oracle.jdbc.OracleResultSet;
    import oracle.sql.BLOB;
    import org.apache.log4j.Logger;
    import Util_Connect.DataBase;
    public class UploadFile extends HttpServlet
    private static final String CONTENT_TYPE = "text/html; charset=windows-1252";
    //static final Logger logger = Logger.getLogger(UploadFile.class);
    public void init(ServletConfig config) throws ServletException
    super.init(config);
    public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
    String headerName = null;
    Enumeration en = request.getHeaderNames();
    try
    while ( en.hasMoreElements() )
    Object ob = en.nextElement();
    headerName = ob.toString();
    System.out.println("Value for headerNAme is >"+headerName+"<");
    String aaa = request.getHeader(headerName);
    System.out.println("Value for aa is >"+aaa+"<");
    catch (Exception ex)
    System.out.println("Error in extracting request headers"+ex.toString());
    Connection conn = getConnection("wizard");
    BLOB blob = null;
    try
    conn.setAutoCommit(false);
    String cmd = "SELECT * FROM so_cs.testlob WHERE docno = 1 FOR UPDATE";
    PreparedStatement pstmt = conn.prepareStatement(cmd);
    ResultSet rset = pstmt.executeQuery(cmd);
    rset.next();
    blob = ((OracleResultSet)rset).getBLOB(2);
    //File binaryFile = new File("h:\\callcenterpilot.doc");
    //System.out.println("Document length = " + binaryFile.length());
    //FileInputStream instream = new FileInputStream(binaryFile);
    response.setHeader("Content-Type","application/vnd.ms-word");
    String contentType = request.getContentType();
    System.out.println("Content type received in servlet is >"+contentType+"<");
    ServletInputStream instream = request.getInputStream();
    OutputStream outstream = blob.getBinaryOutputStream();
    int size = blob.getBufferSize();
    byte[] buffer = new byte[size];
    int length = -1;
    while ((length = instream.read(buffer)) != -1)
    outstream.write(buffer, 0, length);
    instream.close();
    outstream.close();
    conn.commit();
    closeConnection(conn);
    response.setContentType(CONTENT_TYPE);
    PrintWriter out = response.getWriter();
    catch (Exception ex)
    System.out.println("Error =- > "+ex.toString());
    //out.println("</body></html>");
    //out.close();
    private Connection getConnection(String dataBase)
    Connection conn = null;
    try
    conn = DataBase.getPoolConnection(dataBase);
    catch (Exception se)
    System.err.println("Error getting connection: "+se.toString());
    return conn;
    private void closeConnection(Connection conn)
    if (conn != null)
    try
    conn.close();
    catch (Exception se)
    System.err.println("Error closing connection in get last imei"+se.toString());
    This is what the display servlet is showing when the JSP/Servlet insert the document
    -----------------------------7d31422224030e
    Content-Disposition: form-data; name="example"; filename="H:\(your name) Skills Matrix.doc"
    Content-Type: application/msword
    �� ࡱ � > ��     � � ���� � � ���������������������
    Tks
    Andre

    hello,
    there are multiple documents out there, describing the oracle reports server setup. try doc.oracle.com for documentation.
    also it is part of the online-documentation.
    you need to install 9iAS enterprise edition. the server is pre-configured and will listen to the url http://yourserver/dev60cgi/rwcgi60.exe
    passing only this url you will get a help-screen, describing the syntax.
    regards,
    the oracle reports team

  • How to store images in BLOB field in MySql database using java

    Hi....
    Currently am able to store character string into BLOB using byte array....in MySql.
    but i cannot store images or pictures.......
    to do this.........please help me out...............
    Thanx..........:)Bye...........

    Hello,
    I have done this for Oracle but it should be similar in MySQL also. Try reading thru these links below. Mail us if you have succeeded or not.
    http://forum.java.sun.com/thread.jspa?forumID=48&threadID=654086
    http://forum.java.sun.com/thread.jspa?forumID=48&threadID=384768
    http://forum.java.sun.com/thread.jspa?forumID=48&threadID=549705
    Thanks and regards,
    Pazhanikanthan. P

  • Upload a file in a BLOB Oracle variable

    Hello all,
    i am developing a web application to upload a binary file in an Oracle database (9i) in a BLOB variable.
    the input is stored in a FILE object wich is temporary stored in a folder (C:\\APP). after the upload in the BLOB the file should be deleted. I get the following error
    java.lang.NullPointerException
         at com.merck.cdm.BlobOracle.insertBLOB(BlobOracle.java:98)
    when I try to get the file for the FileInputStream. It seems I am not able to acces the FILE object once defined.
    any help is welcome
    thanks
    claudio
    this is the code:
    package com.merck.cdm;
    import java.sql.*;
    import java.io.*;
    import java.sql.PreparedStatement;
    import java.util.*;
    import com.oreilly.servlet.MultipartRequest;
    import com.oreilly.servlet.multipart.DefaultFileRenamePolicy;
    import javax.servlet.http.HttpServletRequest;
    import oracle.jdbc.driver.*;
    import oracle.sql.BLOB;
    * Insert record in the MEDIA table
    * MEDIA (file_name varchar2(256), file_content BLOB);
    public class BlobOracle
    private final static String hostname = "itpo0002.merck.com";
    private final static String port = "1521";
    private final static String sid = "TIRWEB";
    private final static String username = "test_blob";
    private final static String password = "password";
    private static String fileLocation;
    private static Connection connection;
    public BlobOracle()
    public boolean processAddRequest(HttpServletRequest request, String sAbsolutePath)
    throws IOException, SQLException, Exception
         boolean bParamsOk = true;
    boolean bAttachOk = true;
    //Acquire request parameters we need .
    //5 MB's limit
    //the work directory will be "TOMCAT_HOME\bin, and the user can provide another one like C:\workDir
    //the file will be deleted as soon as the message will be sent
    //m_mpReq = new MultipartRequest(request, ".", 5 * 1024 * 1024);
    //m_mpReq = new MultipartRequest(request, "/opt/www/corp/ats-crf/java/ats-crf/attachment/", 5 * 1024 * 1024);
    //String sWorkDir = File.separator + sAbsolutePath + "attachment" + File.separator;
    MultipartRequest mpRequest = new MultipartRequest(request, "C:\\app", 8 * 1024 * 1024);
    // upload file in a temp dir
              //il form � di tipo enctype="multipart/form-data" e quindi il metodo getParameter di java.lang.string non funziona
              //bisogna quindi usare l'analogo metodo di MultipartRequest
              String fileName = mpRequest.getFilesystemName("upload_file");
    System.out.println("fileName is " + fileName);
    File file; //creo un oggetto di tipo "file" dal file nella cartella temporanea
    file = mpRequest.getFile("C:\\app");
    //String fileName = file.getName();
    //Connection;
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    Connection con = DriverManager.getConnection("jdbc:oracle:thin:@"+hostname+ ":"+ port +":"+ sid , username , password);
    con.setAutoCommit(false);// we must control the commit SE METTO TRUE FUNZIONA MA DA UN ALTRO ERRORE;
    insertBLOB(fileName, file, con);//passo il nome del file e l'oggetto file
    return (bAttachOk && bParamsOk);
    public void insertBLOB(String strFileName, File AttachedFile, Connection connection) throws SQLException, Exception
    long ts1 = System.currentTimeMillis();
    ResultSet rs = null;
    Statement stmt = null;
    //Create a statement.
    StringBuffer sbSql = new StringBuffer();
    sbSql.append("INSERT INTO media\n");
    sbSql.append("(file_name, file_content)\n");
    sbSql.append("values ('" + strFileName + "', empty_blob())");
    connection.setAutoCommit(false);
    stmt = connection.createStatement();
    stmt.execute(sbSql.toString());
    System.out.println(sbSql);
    //Take back the record for update (we will insert the blob)
    StringBuffer sbSqlBody = new StringBuffer();
    sbSqlBody.append("SELECT file_content FROM media\n");
    sbSqlBody.append("WHERE file_name = '" + strFileName + "' for update");
    //Execute the query, and we must have one record so take it
    rs = stmt.executeQuery(sbSqlBody.toString());
    rs.next();
    System.out.println(sbSqlBody);
    //Use the OracleDriver resultset, we take the blob locator
    BLOB blob = ((OracleResultSet)(rs)).getBLOB("file_content");
    //copyFileIntoBlob(AttachedFile, blob);
    System.out.println("Start copyFileIntoBlob");
    System.out.println("attached length = " + AttachedFile.length()); <-GOT THE ERROR HERE
    FileInputStream instream = new FileInputStream(AttachedFile);
    System.out.println("before getBinaryOutputStream");
    OutputStream outstream = blob.getBinaryOutputStream();
    System.out.println("after getBinaryOutputStream");
    //Call getChunkSize() to determine the ideal chunk size to write to the BLOB,
    //then create the buffer byte array.
    int chunk = blob.getChunkSize();
    byte[] buffer = new byte[chunk];
    int length = -1;
    while ((length = instream.read(buffer)) != -1)
    outstream.write(buffer, 0, length);
    instream.close();
    outstream.close();
    System.out.println("End copyFileIntoBlob");
    long ts2 = System.currentTimeMillis();
    connection.commit();
    connection.close();
    //cancella il file
    AttachedFile.delete();
    //cancella il file
    System.out.println("\n"+ (ts2 - ts1) +" ms" );
    ******************************************************

    You are getting NullPointerException because the input parameter AttachedFile to the function
    public void insertBLOB(String strFileName, File AttachedFile, Connection connection)is null.
    First check if the file object is null here: before passing it on to the function.
    File file; //creo un oggetto di tipo "file" dal file nella cartella temporanea
    file = mpRequest.getFile("C:\\app");I don't think file = mpRequest.getFile("C:\\app"); will work if
    app is just a directory, try specifying a file name there.
    Message was edited by:
    appy77

  • NullPointerException at oracle.sql.BLOB.createTemporary(BLOB.java:590)

    Hi,
    I seldom use the BLOB. Here is the coding that creates a BLOB.
    private  BLOB getBlob(byte[] str, Connection con) throws SQLException, IOException {
      BLOB blob = BLOB.createTemporary(con, true, BLOB.DURATION_SESSION);
      blob.open(BLOB.MODE_READWRITE);
      OutputStream writer = blob.getBinaryOutputStream();
      writer.write(str);
      writer.flush();
      writer.close();
      blob.close();
      return blob;
    After inserting this BLOB into database table via ojdbc, BLOB.freeTemporary() is called.
         BLOB blob = getBlob(compressedClaim,connStore);
         rsImagePstmt.setObject(4,blob);
         rsImagePstmt.executeUpdate();
         BLOB.freeTemporary( blob );
    Sometimes it's running ok and finished properly. Sometimes I got the following exception after running 2.5 hours.
    Thanks a lot for any suggestion and help.  We use oracle 10.2 and java1.4 library here.
                                      > Exception: java.lang.NullPointerException
                                      >                           at oracle.jdbc.driver.T2CConnection.checkError(T2CConnection.java:669)
                                      >                           at oracle.jdbc.driver.T2CConnection.checkError(T2CConnection.java:602)
                                      >                           at oracle.jdbc.driver.T2CConnection.createTemporaryBlob(T2CConnection.java:2039)
                                      >                           at oracle.sql.BLOB.createTemporary(BLOB.java:590)
    If I ran in the debug mode, I got the following errors after 2.5 hours:
    An unexpected exception has been detected in native code outside the VM.
    Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x62F0BCF4
    Function=Java_oracle_jdbc_driver_T2CStatement_t2cFetchDmlReturnParams+0x594
    Library=C:\oracle\product\10.2.0\client\BIN\ocijdbc10.dll
    Current Java thread:
      at oracle.jdbc.driver.T2CConnection.lobCreateTemporary(Native Method)
      at oracle.jdbc.driver.T2CConnection.createTemporaryBlob(T2CConnection.java:2039)
      at oracle.sql.BLOB.createTemporary(BLOB.java:590)
      at com.viant.consumer.impl.RateSheetConsumer.getBlob(RateSheetConsumer.java:386)
      at com.viant.consumer.impl.RateSheetConsumer.finishRateSheet(RateSheetConsumer.java:293)
      at com.viant.consumer.impl.RateSheetConsumer.run(RateSheetConsumer.java:156)
      at java.lang.Thread.run(Thread.java:534)
    Dynamic libraries:
    0x00400000 - 0x0040B000  C:\jdk1.4\bin\javaw.exe
    0x77220000 - 0x7735C000  C:\Windows\SYSTEM32\ntdll.dll
    0x76CE0000 - 0x76DB4000  C:\Windows\system32\kernel32.dll
    0x75620000 - 0x7566B000  C:\Windows\system32\KERNELBASE.dll
    0x758D0000 - 0x75970000  C:\Windows\system32\ADVAPI32.dll
    0x75C10000 - 0x75CBC000  C:\Windows\system32\msvcrt.dll
    0x75B20000 - 0x75B39000  C:\Windows\SYSTEM32\sechost.dll
    0x77170000 - 0x77211000  C:\Windows\system32\RPCRT4.dll
    0x75B40000 - 0x75C09000  C:\Windows\system32\USER32.dll
    0x75D50000 - 0x75D9E000  C:\Windows\system32\GDI32.dll
    0x77440000 - 0x7744A000  C:\Windows\system32\LPK.dll
    0x76F90000 - 0x7702D000  C:\Windows\system32\USP10.dll
    0x77360000 - 0x7737F000  C:\Windows\system32\IMM32.DLL
    0x75A00000 - 0x75ACC000  C:\Windows\system32\MSCTF.dll
    0x62A20000 - 0x62A2C000  C:\PROGRA~1\NETINST\NIAMH.DLL
    0x75330000 - 0x75368000  C:\PROGRA~1\SOPHOS\SOPHOS~1\SOPHOS~1.DLL
    0x77420000 - 0x77425000  C:\Windows\system32\PSAPI.DLL
    0x752B0000 - 0x752C5000  C:\Windows\system32\AMINIT32.DLL
    0x08000000 - 0x08139000  C:\jdk1.4\jre\bin\client\jvm.dll
    0x73510000 - 0x73542000  C:\Windows\system32\WINMM.dll
    0x75210000 - 0x7525C000  C:\Windows\system32\apphelp.dll
    0x10000000 - 0x10007000  C:\jdk1.4\jre\bin\hpi.dll
    0x00270000 - 0x0027E000  C:\jdk1.4\jre\bin\verify.dll
    0x00280000 - 0x00299000  C:\jdk1.4\jre\bin\java.dll
    0x002A0000 - 0x002AD000  C:\jdk1.4\jre\bin\zip.dll
    0x003D0000 - 0x003EC000  C:\jdk1.4\jre\bin\jdwp.dll
    0x002B0000 - 0x002B5000  C:\jdk1.4\jre\bin\dt_socket.dll
    0x773E0000 - 0x77415000  C:\Windows\system32\ws2_32.dll
    0x75970000 - 0x75976000  C:\Windows\system32\NSI.dll
    0x736D0000 - 0x736E0000  C:\Windows\system32\NLAapi.dll
    0x71BE0000 - 0x71BF0000  C:\Windows\system32\napinsp.dll
    0x71BA0000 - 0x71BB2000  C:\Windows\system32\pnrpnsp.dll
    0x74D50000 - 0x74D8C000  C:\Windows\System32\mswsock.dll
    0x74C10000 - 0x74C54000  C:\Windows\system32\DNSAPI.dll
    0x71BF0000 - 0x71BF8000  C:\Windows\System32\winrnr.dll
    0x71C30000 - 0x71C57000  C:\Program Files\Common Files\Microsoft Shared\Windows Live\WLIDNSP.DLL
    0x75DA0000 - 0x75DF7000  C:\Windows\system32\SHLWAPI.dll
    0x74370000 - 0x7438C000  C:\Windows\system32\IPHLPAPI.DLL
    0x74820000 - 0x74827000  C:\Windows\system32\WINNSI.DLL
    0x721E0000 - 0x72218000  C:\Windows\System32\fwpuclnt.dll
    0x71C20000 - 0x71C26000  C:\Windows\system32\rasadhlp.dll
    0x74840000 - 0x74857000  C:\ProgramData\Sophos\Web Intelligence\swi_ifslsp.dll
    0x74830000 - 0x74839000  C:\Windows\system32\VERSION.dll
    0x76090000 - 0x76CDB000  C:\Windows\system32\SHELL32.dll
    0x74810000 - 0x74815000  C:\Windows\System32\wshtcpip.dll
    0x01240000 - 0x0124F000  C:\jdk1.4\jre\bin\net.dll
    0x62F00000 - 0x62F13000  C:\oracle\product\10.2.0\client\BIN\ocijdbc10.dll
    0x08450000 - 0x084A9000  C:\oracle\product\10.2.0\client\bin\OCI.dll
    0x7C340000 - 0x7C396000  C:\Windows\system32\MSVCR71.dll
    0x61C20000 - 0x61E77000  C:\oracle\product\10.2.0\client\bin\OraClient10.Dll
    0x60870000 - 0x60956000  C:\oracle\product\10.2.0\client\bin\oracore10.dll
    0x60A80000 - 0x60B47000  C:\oracle\product\10.2.0\client\bin\oranls10.dll
    0x63690000 - 0x636A8000  C:\oracle\product\10.2.0\client\bin\oraunls10.dll
    0x60EB0000 - 0x60EB7000  C:\oracle\product\10.2.0\client\bin\orauts.dll
    0x75770000 - 0x758CC000  C:\Windows\system32\ole32.dll
    0x636B0000 - 0x636B6000  C:\oracle\product\10.2.0\client\bin\oravsn10.dll
    0x60FA0000 - 0x61098000  C:\oracle\product\10.2.0\client\bin\oracommon10.dll
    0x63430000 - 0x63457000  C:\oracle\product\10.2.0\client\bin\orasnls10.dll
    0x08C40000 - 0x091B8000  C:\oracle\product\10.2.0\client\bin\orageneric10.dll
    0x091C0000 - 0x09337000  C:\oracle\product\10.2.0\client\bin\oraxml10.dll
    0x014F0000 - 0x01501000  C:\Windows\system32\MSVCIRT.dll
    0x60960000 - 0x60A77000  C:\oracle\product\10.2.0\client\bin\oran10.dll
    0x62740000 - 0x62780000  C:\oracle\product\10.2.0\client\bin\oranl10.dll
    0x62790000 - 0x627A8000  C:\oracle\product\10.2.0\client\bin\oranldap10.dll
    0x627F0000 - 0x628FD000  C:\oracle\product\10.2.0\client\bin\orannzsbb10.dll
    0x62530000 - 0x62583000  C:\oracle\product\10.2.0\client\bin\oraldapclnt10.dll
    0x62670000 - 0x6268B000  C:\oracle\product\10.2.0\client\bin\orancrypt10.dll
    0x71230000 - 0x71237000  C:\Windows\system32\WSOCK32.dll
    0x75CC0000 - 0x75D4F000  C:\Windows\system32\OLEAUT32.dll
    0x62920000 - 0x6296D000  C:\oracle\product\10.2.0\client\bin\oranro10.dll
    0x626B0000 - 0x626B7000  C:\oracle\product\10.2.0\client\bin\oranhost10.dll
    0x62660000 - 0x62666000  C:\oracle\product\10.2.0\client\bin\orancds10.dll
    0x629C0000 - 0x629C8000  C:\oracle\product\10.2.0\client\bin\orantns10.dll
    0x09340000 - 0x096B5000  C:\oracle\product\10.2.0\client\bin\orapls10.dll
    0x07B80000 - 0x07B89000  C:\oracle\product\10.2.0\client\bin\oraslax10.dll
    0x63080000 - 0x63285000  C:\oracle\product\10.2.0\client\bin\oraplp10.dll
    0x61ED0000 - 0x61F68000  C:\oracle\product\10.2.0\client\bin\orahasgen10.dll
    0x62AB0000 - 0x62B24000  C:\oracle\product\10.2.0\client\bin\oraocr10.dll
    0x084B0000 - 0x084F9000  C:\oracle\product\10.2.0\client\bin\oraocrb10.dll
    0x73860000 - 0x73871000  C:\Windows\system32\NETAPI32.dll
    0x74B00000 - 0x74B09000  C:\Windows\system32\netutils.dll
    0x74F80000 - 0x74F99000  C:\Windows\system32\srvcli.dll
    0x73850000 - 0x7385F000  C:\Windows\system32\wkscli.dll
    0x73840000 - 0x7384F000  C:\Windows\system32\SAMCLI.DLL
    0x74BE0000 - 0x74C02000  C:\Windows\system32\LOGONCLI.DLL
    0x62980000 - 0x62991000  C:\oracle\product\10.2.0\client\bin\orantcp10.dll
    0x63520000 - 0x635BB000  C:\oracle\product\10.2.0\client\bin\orasql10.dll
    0x751E0000 - 0x751FB000  C:\Windows\system32\SspiCli.dll
    0x70890000 - 0x7089B000  C:\Windows\system32\cscapi.dll
    0x75290000 - 0x7529C000  C:\Windows\system32\CRYPTBASE.dll
    0x740B0000 - 0x740F0000  C:\Windows\system32\uxtheme.dll
    0x09B80000 - 0x09C92000  C:\jdk1.4\jre\bin\awt.dll
    0x72870000 - 0x728C1000  C:\Windows\system32\WINSPOOL.DRV
    0x09810000 - 0x09861000  C:\jdk1.4\jre\bin\fontmanager.dll
    0x0ACF0000 - 0x0ADD7000  C:\Windows\system32\ddraw.dll
    0x73AA0000 - 0x73AA6000  C:\Windows\system32\DCIMAN32.dll
    0x76DF0000 - 0x76F8D000  C:\Windows\system32\SETUPAPI.dll
    0x753F0000 - 0x75417000  C:\Windows\system32\CFGMGR32.dll
    0x75450000 - 0x75462000  C:\Windows\system32\DEVOBJ.dll
    0x73C80000 - 0x73C93000  C:\Windows\system32\dwmapi.dll
    0x0ADE0000 - 0x0AE71000  C:\Windows\system32\igdumdx32.dll
    0x0AF10000 - 0x0B3E1000  C:\Windows\system32\igdumd32.dll
    0x742C0000 - 0x742E5000  C:\Windows\system32\PowrProf.dll
    0x66150000 - 0x6621C000  C:\Windows\system32\D3DIM700.DLL
    0x76DC0000 - 0x76DEA000  C:\Windows\system32\imagehlp.dll
    0x70BF0000 - 0x70CDB000  C:\Windows\system32\dbghelp.dll
    Heap at VM Abort:
    Heap
      def new generation   total 4608K, used 291K [0x10010000, 0x10510000, 0x12770000)
       eden space 4096K,   5% used [0x10010000, 0x10046aa0, 0x10410000)
       from space 512K,  14% used [0x10490000, 0x104a2208, 0x10510000)
       to   space 512K,   0% used [0x10410000, 0x10410000, 0x10490000)
      tenured generation   total 60544K, used 56437K [0x12770000, 0x16290000, 0x30010000)
        the space 60544K,  93% used [0x12770000, 0x15e8d4b8, 0x15e8d600, 0x16290000)
      compacting perm gen  total 12800K, used 12682K [0x30010000, 0x30c90000, 0x34010000)
        the space 12800K,  99% used [0x30010000, 0x30c72900, 0x30c72a00, 0x30c90000)
    Local Time = Thu Oct 17 11:29:35 2013
    Elapsed Time = 9003
    # The exception above was detected in native code outside the VM

    Hi!
    It seems you can do this:
              try {
                   conn = new OracleDriver().defaultConnection();                graphblob = oracle.sql.BLOB.createTemporary(conn, false,oracle.sql.BLOB.DURATION_CALL); // must init
                   System.out.println("Blob is init");
              } catch ( java.sql.SQLException sEx ) {
                   throw new RuntimeException ("No connection", sEx);
    http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:1285601748584
    http://www.unix.org.ua/orelly/oracle/guide8i/ch09_08.htm
    /Bjoern

  • How to convert oracle BLOB to String

    Hi,
    I am working on an GIS project using Oracle database which stores the spatial data. When I read the polygon points data which is saved as BLOB type in database table and convert the BLOB to byte[], there is no problem. However when the data is converted to Character, those characters are not recognized something like this:
    �����������?�����?���w�����������������!����?o����s��8��n�����H��?
    ������������������ �?&�?�����|��?��������?���������������L�?
    This is the method I used to convert BLOB to String below:
    -----mapb is the BLOB instance.
    byte[] images = mapb.getBytes(1,(int)mapb.length());
    String newstring = new String(images);
    Is that decoding problem?
    Can somebody help me for this problem?
    Thanks in advance!
    XR

    Hi,
    Thanks for reply,
    Actually the data is ESRI spatial data saved in ORACLE database.
    the BLOB is not a column, it is part of column of st_geometry.
    I looked at some docs in ESRI, they save points which is the last part of st_geometry field with BLOB type. I use the jdbc to get the geometry data and use STRUCT and Datum class to get all members of the st_geometry data. There are 14 members in the field, I can cast most of them into String through Datum instance, but the object #14 is BLOB, will not allow me cast it to String directly, so I use byte[] and cast it though new String().
    some of the lines here:
    STRUCT st = (oracle.sql.STRUCT) rs.getObject("shape");
    Datum[] dtms = st.getOracleAttributes();
    BLOB mapb = null;
    for (int i=0;i<dtms.length;i++){
    if (!(dtms[i] == null)){
    if (i==13){
    mapb = (BLOB)dtms;
    } else {
    log.info("data" + i + "=" + dtms[i].stringValue());
    byte[] images = mapb.getBytes(1,(int)mapb.length());
    String newstring = new String(images);
    Thanks again for your reply.
    XR

  • Self Service Restore - Data Centre Failure

    I'm evaluating the new 'Standard' tier of SQL database and self service restore feature. My question is about where the backups are stored for self service restore and whether they help in a full data centre failure. e.g. If my Standard SQL db is in Europe
    West and the only backup I am using is the in built self service restore. Do I have any protection if Europe West has a major DR event? Or do I still need to export the databases to blob storage to handle this kind of event? (Whereby I would need to restore
    to Europe North manually)

    As indicated in the "Service Tiers Details" table in this
    blog posting , we have a couple of new features which are not yet enabled for the new tiers.
    One feature will be the ability to restore a database to an alternate datacenter in case the primary data center you are using is not available OR for any other reason you may want to restore a database in an alternate location.  This recovery option
    uses geo-replicated backups.  For this feature we only geo-replicate the full and daily backups but not the log backups so point-in-time restore is not possible but you will have an RPO of less than 24-hours.  Think of this as always having access
    to daily off-site backups from any location.  This feature will be available for Basic, Standard and Premium. 
    The second feature which we will enable later is the geo-replication for Standard.  This feature will allow you to opt-in for geo-replicating your Standard database to a passive secondary in an alternate location.  We will have more details about
    this feature in a few weeks.
    Until you have access to one of the above two features you will have to use the export-to-blob for the datacenter failure case.  We are working hard to deliver the above two features as soon as we can.
    I hope this helps.
    Tonyp

Maybe you are looking for