Retrieving BLOB in CMP2.0 from Oracle 8.1.7.3

Hi all,
In one of our project we are using CMP 2.0 and WLS8.1 SP2. While storing BLOB into Oracle (8.1.7) database we are not facing any issue.
But retrieving the BLOB from the database throwing error.
In weblogic.cmp.jar.xml I have defined the database column as below
<field-map>
<cmp-field>pendingUser</cmp-field>
<dbms-column>PENDING_USER</dbms-column>
<dbms-column-type>OracleBlob</dbms-column-type>
</field-map>
Stack trace of the issue is below
javax.ejb.FinderException: Exception executing finder 'findByAdministrator':
java.io.StreamCorruptedException: invalid stream header
java.io.StreamCorruptedException: invalid stream header
at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:737)
at java.io.ObjectInputStream.<init>(ObjectInputStream.java:253)
at com.boa.gcib.docwf.ecf.ejbs.pendinguser.PendingUserEntity_2zvzps__WebLo
gic_CMP_RDBMS.__WL_set_pendingUserForInput(PendingUserEntity_2zvzps__WebLogic_CMP_
RDBMS.java:2258)
at com.boa.gcib.docwf.ecf.ejbs.pendinguser.PendingUserEntity_2zvzps__WebLo
gic_CMP_RDBMS.__WL_loadGroup0FromRS(PendingUserEntity_2zvzps__WebLogic_CMP_RDBMS.j
ava:868)
at com.boa.gcib.docwf.ecf.ejbs.pendinguser.PendingUserEntity_2zvzps__WebLo
gic_CMP_RDBMS.__WL_loadGroupByIndex(PendingUserEntity_2zvzps__WebLogic_CMP_RDBMS.j
ava:1100)
at weblogic.ejb20.cmp.rdbms.RDBMSPersistenceManager.loadBeanFromRS(RDBMSPe
rsistenceManager.java:428)
at weblogic.ejb20.manager.DBManager.getBeanFromRS(DBManager.java:1435)
at weblogic.ejb20.manager.BaseEntityManager.getBeanFromRS(BaseEntityManage
r.java:1207)
at weblogic.ejb20.cmp.rdbms.RDBMSPersistenceManager.getBeanFromRS(RDBMSPer
sistenceManager.java:2015)
at com.boa.gcib.docwf.ecf.ejbs.pendinguser.PendingUserEntity_2zvzps__WebLo
gic_CMP_RDBMS.ejbFindByAdministrator(PendingUserEntity_2zvzps__WebLogic_CMP_RDBMS.
java:537)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.ja
va:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccesso
rImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at weblogic.ejb20.cmp.rdbms.RDBMSPersistenceManager.collectionFinder(RDBMS
PersistenceManager.java:378)
at weblogic.ejb20.manager.BaseEntityManager.collectionFinder(BaseEntityMan
ager.java:1700)
at weblogic.ejb20.manager.BaseEntityManager.collectionFinder(BaseEntityMan
ager.java:1672)
at weblogic.ejb20.internal.EntityEJBHome.finder(EntityEJBHome.java:560)
at com.boa.gcib.docwf.ecf.ejbs.pendinguser.PendingUserEntity_2zvzps_HomeIm
pl.findByAdministrator(PendingUserEntity_2zvzps_HomeImpl.java:128)
at com.boa.gcib.docwf.ecf.ejbs.user.UserManagerBean.getRequestedAccounts(U
serManagerBean.java:1158)
at com.boa.gcib.docwf.ecf.ejbs.user.UserManager_iq4580_EOImpl.getRequested
Accounts(UserManager_iq4580_EOImpl.java:46)
at com.boa.gcib.docwf.ecf.ejbs.user.UserManager_iq4580_EOImpl_WLSkel.invok
e(Unknown Source)
at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:477)
at weblogic.rmi.cluster.ReplicaAwareServerRef.invoke(ReplicaAwareServerRef
.java:108)
at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:420)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedS
ubject.java:353)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:14
4)
at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:
415)
at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.j
ava:30)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)
at com.boa.gcib.docwf.ecf.ejbs.pendinguser.PendingUserEntity_2zvzps__WebLo
gic_CMP_RDBMS.ejbFindByAdministrator(PendingUserEntity_2zvzps__WebLogic_CMP_RDBMS.
java:556)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.ja
va:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccesso
rImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at weblogic.ejb20.cmp.rdbms.RDBMSPersistenceManager.collectionFinder(RDBMS
PersistenceManager.java:378)
at weblogic.ejb20.manager.BaseEntityManager.collectionFinder(BaseEntityMan
ager.java:1700)
at weblogic.ejb20.manager.BaseEntityManager.collectionFinder(BaseEntityMan
ager.java:1672)
at weblogic.ejb20.internal.EntityEJBHome.finder(EntityEJBHome.java:560)
at com.boa.gcib.docwf.ecf.ejbs.pendinguser.PendingUserEntity_2zvzps_HomeIm
pl.findByAdministrator(PendingUserEntity_2zvzps_HomeImpl.java:128)
at com.boa.gcib.docwf.ecf.ejbs.user.UserManagerBean.getRequestedAccounts(U
serManagerBean.java:1158)
at com.boa.gcib.docwf.ecf.ejbs.user.UserManager_iq4580_EOImpl.getRequested
Accounts(UserManager_iq4580_EOImpl.java:46)
at com.boa.gcib.docwf.ecf.ejbs.user.UserManager_iq4580_EOImpl_WLSkel.invok
e(Unknown Source)
at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:477)
at weblogic.rmi.cluster.ReplicaAwareServerRef.invoke(ReplicaAwareServerRef
.java:108)
at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:420)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedS
ubject.java:353)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:14
4)
at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:
415)
at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.j
ava:30)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)
Is there anything I am missing?
Please help me!
Thanks a lot in advance,
Mahesh
Message was edited by:
Maheshindia

There is a new flag named 'serialize-byte-array-to-oracle-blob' and it was
introduced in SP2. Check whether that flag is useful. More info can be found
on the SP2 release notes -
http://e-docs.bea.com/wls/docs81/notes/resolved_sp02.html
--Sathish
<Mahesh Patil> wrote in message news:[email protected]...
Hi all,
In one of our project we are using CMP 2.0 and WLS8.1 SP2. While storing
BLOB into Oracle (8.1.7) database we are not facing any issue.
But retrieving the BLOB from the database throwing error.
In weblogic.cmp.jar.xml I have defined the database column as below
<field-map>
<cmp-field>pendingUser</cmp-field>
<dbms-column>PENDING_USER</dbms-column>
<dbms-column-type>OracleBlob</dbms-column-type>
</field-map>
Stack trace of the issue is below
javax.ejb.FinderException: Exception executing finder
'findByAdministrator':
java.io.StreamCorruptedException: invalid stream header
java.io.StreamCorruptedException: invalid stream header
at
java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:737)
at java.io.ObjectInputStream.<init>(ObjectInputStream.java:253)
at
com.boa.gcib.docwf.ecf.ejbs.pendinguser.PendingUserEntity_2zvzps__WebLo
gic_CMP_RDBMS.__WL_set_pendingUserForInput(PendingUserEntity_2zvzps__WebLogic_CMP_
RDBMS.java:2258)
at
com.boa.gcib.docwf.ecf.ejbs.pendinguser.PendingUserEntity_2zvzps__WebLo
gic_CMP_RDBMS.__WL_loadGroup0FromRS(PendingUserEntity_2zvzps__WebLogic_CMP_RDBMS.j
ava:868)
at
com.boa.gcib.docwf.ecf.ejbs.pendinguser.PendingUserEntity_2zvzps__WebLo
gic_CMP_RDBMS.__WL_loadGroupByIndex(PendingUserEntity_2zvzps__WebLogic_CMP_RDBMS.j
ava:1100)
at
weblogic.ejb20.cmp.rdbms.RDBMSPersistenceManager.loadBeanFromRS(RDBMSPe
rsistenceManager.java:428)
at
weblogic.ejb20.manager.DBManager.getBeanFromRS(DBManager.java:1435)
at
weblogic.ejb20.manager.BaseEntityManager.getBeanFromRS(BaseEntityManage
r.java:1207)
at
weblogic.ejb20.cmp.rdbms.RDBMSPersistenceManager.getBeanFromRS(RDBMSPer
sistenceManager.java:2015)
at
com.boa.gcib.docwf.ecf.ejbs.pendinguser.PendingUserEntity_2zvzps__WebLo
gic_CMP_RDBMS.ejbFindByAdministrator(PendingUserEntity_2zvzps__WebLogic_CMP_RDBMS.
java:537)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.ja
va:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccesso
rImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at
weblogic.ejb20.cmp.rdbms.RDBMSPersistenceManager.collectionFinder(RDBMS
PersistenceManager.java:378)
at
weblogic.ejb20.manager.BaseEntityManager.collectionFinder(BaseEntityMan
ager.java:1700)
at
weblogic.ejb20.manager.BaseEntityManager.collectionFinder(BaseEntityMan
ager.java:1672)
at
weblogic.ejb20.internal.EntityEJBHome.finder(EntityEJBHome.java:560)
at
com.boa.gcib.docwf.ecf.ejbs.pendinguser.PendingUserEntity_2zvzps_HomeIm
pl.findByAdministrator(PendingUserEntity_2zvzps_HomeImpl.java:128)
at
com.boa.gcib.docwf.ecf.ejbs.user.UserManagerBean.getRequestedAccounts(U
serManagerBean.java:1158)
at
com.boa.gcib.docwf.ecf.ejbs.user.UserManager_iq4580_EOImpl.getRequested
Accounts(UserManager_iq4580_EOImpl.java:46)
at
com.boa.gcib.docwf.ecf.ejbs.user.UserManager_iq4580_EOImpl_WLSkel.invok
e(Unknown Source)
at
weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:477)
at
weblogic.rmi.cluster.ReplicaAwareServerRef.invoke(ReplicaAwareServerRef
.java:108)
at
weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:420)
at
weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedS
ubject.java:353)
at
weblogic.security.service.SecurityManager.runAs(SecurityManager.java:14
4)
at
weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:
415)
at
weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.j
ava:30)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)
at
com.boa.gcib.docwf.ecf.ejbs.pendinguser.PendingUserEntity_2zvzps__WebLo
gic_CMP_RDBMS.ejbFindByAdministrator(PendingUserEntity_2zvzps__WebLogic_CMP_RDBMS.
java:556)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.ja
va:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccesso
rImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at
weblogic.ejb20.cmp.rdbms.RDBMSPersistenceManager.collectionFinder(RDBMS
PersistenceManager.java:378)
at
weblogic.ejb20.manager.BaseEntityManager.collectionFinder(BaseEntityMan
ager.java:1700)
at
weblogic.ejb20.manager.BaseEntityManager.collectionFinder(BaseEntityMan
ager.java:1672)
at
weblogic.ejb20.internal.EntityEJBHome.finder(EntityEJBHome.java:560)
at
com.boa.gcib.docwf.ecf.ejbs.pendinguser.PendingUserEntity_2zvzps_HomeIm
pl.findByAdministrator(PendingUserEntity_2zvzps_HomeImpl.java:128)
at
com.boa.gcib.docwf.ecf.ejbs.user.UserManagerBean.getRequestedAccounts(U
serManagerBean.java:1158)
at
com.boa.gcib.docwf.ecf.ejbs.user.UserManager_iq4580_EOImpl.getRequested
Accounts(UserManager_iq4580_EOImpl.java:46)
at
com.boa.gcib.docwf.ecf.ejbs.user.UserManager_iq4580_EOImpl_WLSkel.invok
e(Unknown Source)
at
weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:477)
at
weblogic.rmi.cluster.ReplicaAwareServerRef.invoke(ReplicaAwareServerRef
.java:108)
at
weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:420)
at
weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedS
ubject.java:353)
at
weblogic.security.service.SecurityManager.runAs(SecurityManager.java:14
4)
at
weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:
415)
at
weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.j
ava:30)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)
Is there anything I am missing?
Please help me!
Thanks a lot in advance,
Mahesh
Message was edited by:
Maheshindia

Similar Messages

  • How to store and retrieve blob data type in/from oracle database using JSP

    how to store and retrieve blob data type in/from oracle database using JSP and not using servlet
    thanks

    JSP? Why?
    start here: [http://java.sun.com/developer/onlineTraining/JSPIntro/contents.html]

  • How to retrieve information on UNIX Host from oracle Forms

    Hi,
    Has anybody tried to retrieve manipulated information
    on the Unix Server From the oracle forms running on a client ?.
    If it is to be done by user exit and calling the pro*c code
    then where should the pro*c code exist ?. on server or on client.
    1. If on server then can that code return the value to form ?.
    2. If on client then can that code access the unix server and
    return the value ?..
    OR
    any other method or tool to do the above.
    Thnaks and regards
    null

    I can only tell you what we've done for our system. We have
    client applications which need to send/recv information from the
    UNIX server (report submission, etc.)
    We have a deamon (written in PRO*C) which runs on the UNIX
    server. This deamon constantly monitors a pipe (using the
    DBMS_PIPE package available with ORACLE 7.1). The client apps.
    send requests through this pipe and wait for the server deamon to
    process the request and send responses down a "return pipe".
    This approach has served us well.
    With ORACLE 8, you can (according to what I've read) link
    external object modules (similar to ORA_FFI on the client), which
    would make these OS specific functions available to the database
    developer via PL/SQL but we're just now looking at ORACLE 8 so I
    have no first hand experience with this.
    gautam (guest) wrote:
    : Hi,
    : Has anybody tried to retrieve manipulated information
    : on the Unix Server From the oracle forms running on a client ?.
    : If it is to be done by user exit and calling the pro*c code
    : then where should the pro*c code exist ?. on server or on
    client.
    : 1. If on server then can that code return the value to form ?.
    : 2. If on client then can that code access the unix server and
    : return the value ?..
    : OR
    : any other method or tool to do the above.
    : Thnaks and regards
    null

  • General error when accessing blob from oracle

    Hi
    I have successfully uploaded and saved images into oracle(8.1.5) table DATA_TYPE(dtid number, iconname varchar2(30), icon blob). When I try to retrieve icon from the database, I get "javax.servlet.ServletException: General error" at:
    PreparedStatement pstmt = myConnection.prepareStatement(mySQL);
    My code looks like this:
    imgModifyDataType.jsp
    <%
    ResultSet myResultSet = null;
    Statement myStatement = null;
    Connection myConnection = null;
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
    myConnection = DriverManager.getConnection("Jdbc:Odbc:Te","te","te");
    String iconName;
    String pDTID = request.getParameter("dtid");
    String mySQL = "Select iconname, icon from data_types where dtid=?";
    //Following statement throws general error exception
    PreparedStatement pstmt = myConnection.prepareStatement(mySQL);
    pstmt.setString(1,pDTID);
    myResultSet = pstmt.executeQuery();
    iconName = myResultSet.getString("iconname");
    myUpload.initialize(pageContext);
    myUpload.downloadField(myResultSet,"icon","application/x-msdownload", iconName);
    %>
    One more thing. The error occurs only when I try to execute query retrieving blob data. The same set of statements works fine for simple text or numbers.
    Please help

    When you read a BLOB with ORACLE,
    you have to lock the corresponding row.
    This means that...
    - the connection must not be in "AUTO COMMIT" mode
    - you have to do a "SELECT ... FOR UPDATE"

  • I want resize the image and set position after retrieving from oracle datab

    How can I display image on web page after retrieving it from oracle database. Display is not problem but resize that image and position is very dificult .Please send me Guideline about blob object todisplay and resize it in web pages

    I tried to do the suggetion made by you but I was not able to solve the issue. I think I am close to it and with your help I should be able to resolve it. Let me explain you the brief about this issue.
    1. Another group uses Oracle Apex to load the images in to the database.
    2. I am fetching this data fron Oracle and displays in to Webpage using PHP.
    This is so far I tried. Please bear with me if I am doing anything wrong.
    1.I created program.php which calls the <IMG> as suggested by you.Snippet of the code is
    <div><img src="/oracle/image_story.php" alt="Image Stories" width="900" height="500" /></div>
    2. In the image_story.php, I used the following code.
    <?php
    $query = "SELECT *
              FROM IMAGE_STORY WHERE image_id = 50";
    if ($result = run_oracle($query, 'select')) { // Run the query.
         $num_results = count($result);
         if ($num_results > 0) {
         foreach($result as $row){
              $img = $row['DOCUMT']->load();
              header("Content-type: image/pjpeg");
              echo $img;
              //echo '<div><img src="'.$img.'" alt="Image Stories" width="900" height="500" /></div>';
    ?>
    When I run the program.php,Image is not displayed and it is showing as "X". To troubleshoot the issue,I run the image_story.php and echo $img is giving me the weird character like,
    "ÿØÿàJFIFddÿìDuckyPÿîAdobedÀÿÛ„          
    I used PL/SQL developer as a client to access the BLOB field from the database and in the HTML view, it is giving me the same output.
    Select * from image_story a where a.image_id = 50
    I am not sure the issue is with the MIME-TYPE,ENCODING or I am missing something here. I tried lot of Content-Type.
    Please guide me.

  • Retrieve data from a large table from ORACLE 10g

    I am working with a Microsoft Visual Studio Project that requires to retrieve data from a large table from Oracle 10g database and export the data into the hard drive.
    The problem here is that I am not able to connect to the database directly because of license issue but I can use a third party API to retrieve data from the database. This API has sufficient previllege/license permission on to the database to perform retrieval of data. So, I am not able to use DTS/SSIS or other tool to import data from the database directly connecting to it.
    Here my approach is...first retrieve the data using the API into a .net DataTable and then dump the records from it into the hard drive in a specific format (might be in Excel file/ another SQL server database).
    When I try to retrieve the data from a large table having over 13 lacs records (3-4 GB) in a data table using the visual studio project, I get an Out of memory exception.
    But is there any better way to retrieve the records chunk by chunk and do the export without loosing the state of the data in the table?
    Any help on this problem will be highly appriciated.
    Thanks in advance...
    -Jahedur Rahman
    Edited by: Jahedur on May 16, 2010 11:42 PM

    Girish...Thanks for your reply...But I am sorry for the confusions. Let me explain that...
    1."export the data into another media into the hard drive."
    What does it mean by this line i.e. another media into hard drive???
    ANS: Sorry...I just want to write the data in a file or in a table in SQL server database.
    2."I am not able to connect to the database directly because of license issue"
    huh?? I never heard this question that a user is not able to connect the db because of license. What error / message you are getting?
    ANS: My company uses a 3rd party application that uses ORACLE 10g. And my compnay is licensed to use the 3rd party application (APP+Database is a package) and did not purchased ORACLE license to use directly. So I will not connect to the database directly.
    3.I am not sure which API is you are talking about, but i am running an application of the visual studio data grid or similar kind of controls; in which i can select (select query) as many rows as i needed; no issue.
    ANS: This API is provided by the 3rd party application vendor. I can pass a query to it and it returns a datatable.
    4."better way to retrieve the records chunk by chunk and do the export without loosing the state of the data in the table?"
    ANS: As I get a system error (out of memory) when I select all rows in a datatable at a time, I wanted to retrieve the data in multiple phases.
    E.g: 1 to 20,000 records in 1st phase
    20,001 to 40,000 records in 2nd phase
    40,001 to ...... records in 3nd phase
    and so on...
    Please let me know if this does not clarify your confusions... :)
    Thanks...
    -Jahedur Rahman
    Edited by: user13114507 on May 12, 2010 11:28 PM

  • Problem with Pro*C reading BLOB field from Oracle 10g

    Hello Experts,
    We have a Pro*c application which is reading the BLOB data fields (a PNG image file) from Oracle data base. It holds the BLOB fields returned from the SQL query into a Unsigned Char structure in Pro*C. The program used work fine on AIX 32 – bit 4.3 and Oracle 8.1 environment.
    Recently, we have upgraded the environment to AIX 64-bit 5.3 and Oracle 10g.Since after the Pro*c program has problem in reading the Blob filed.
    Below is the query we are trying to execute –
    EXEC SQL
    SELECT
    signtre_image, image_file_name_ext
    INTO
    :msipLocalImage INDICATOR :msipLocalImage_i,
    :file_name_ext INDICATOR :file_name_ext_i
    FROM
    dcs_sign
    WHERE
    signtre_nbr = :signtre_nbr;
    Here signtre_image is the BLOB fields and msipLocalImage is a Pro*C structure define as below –
    typedef struct tagSignImage
    long len; /* Image length */
    unsigned char img[1]; /* Pointer to first byte. */
    } MOTS_SIGN_IMAGE;
    The quesry does not give any error or exception message in the Pro*C , program just stops at the point of executing the quesry..When we run the query commenting the BLOB filed it works fine. Also, the query runs good when we run it in the Oracle editor.
    There seems to be problem with the way we are reading the BLOB field in the new Oracle 10g enviromet.
    Does any body have any idea what’s wrong with this query? We really need it to work.
    Any Help will be greatly appreciated.
    Thanks,
    - Rajan Yadav

    Thanks a ton for your response.
    We made the necessary changes as suggested by you.This time we got another flavour of error - SQL Error Code - Inconsistent error while reading BLOB.
    Another thing we noticed is that the data field which we are trying to read is defined as LONG RAW instead of a BLOB in data base.
    Are these two things related in any sense or is there anything else which is causing the error.
    Once again Thanks for your help.
    - Rajan Yadav

  • Retrieving record from oracle DB very slow..pls help

    Hi, i'm writing a VB code to retrieving records from Oracle DB Server version 8. I'm using VB Adodb to retrieve the records from various tables. Unfortunately one of the table are very slow to response, the table only contain around 204900 records. The SQL Statement to retrieve the records is a simple SQL Statement that contain WHERE clause only. Any issue that will make the retrieving time become slow? Is that a Indexing? Oracle Driver? Hardware Spec? Or any solution for me to improve the performance. Thanks!

    Well, there are a few things to consider...
    First, can you try executing your query via SQL*Plus? If there are database tuning problems, your query will be slow no matter where you run it.
    Second, are you retrieving significantly more rows in this query than in your other queries? It can take a significant amount of time to retrieve records to the client, even if it's quick to select them.
    Justin

  • Retrieval of xmltype data from oracle 10g to java

    Hi
    Right now we are facing an issue on xmltype retrieval from oracle 10g to java.
    I used xmltype column.getClobval() to get the xml content, but unable to do the parse to get the xml data.
    So i tried getStringval(), getting the xml content as string format and here in this case also, i didn't get document object.
    Here is the code snippet:
    String sql = "SELECT node_id,node_desc,parent_node_id,e.report_xml.getStringval() FROM TABLE_STRUCTURE e";
    st = con.createStatement();
    rs = st.executeQuery(sql);
    while (rs.next()) {
    Object value[] = { rs.getString(1), rs.getString(2), rs.getString(3), rs.getString(4) };
    list.add(value);
    DOMParser parser = new DOMParser();
    parser.parse(rs.getString(4));
    doc = (Document) parser.getDocument();
    System.out.println(": DOM = " + doc.getClass().getName());
    Please do guide in this scenario.
    Thanks in advance.
    Sirisha

    Please see below link
    http://www.stanford.edu/dept/itss/docs/oracle/10g/appdev.101/b10790/xdb11jav.htm

  • Best way to retrieve data from oracle?

    Hi,
    I have a few questions.
    1.)Can a rowtype or a table type returned from oracle database can be retrieved as a dataset or datareader?
    2.)Cursors generally slow down your db(Iam from microsoft sql server back ground). But we seem to be using ref cursors quite a lot here.The only way to return a result as far as i have seen in oracle is to use a ref cursor.Is there any other way?

    Hello,
    1.)Can a rowtype or a table type returned from oracle database can be retrieved as a dataset or datareader?
    I'm not sure how complex your "table types" are -- do you mean PL/SQL Associative Arrays (formerly knowns as "index-by" tables)?
    I believe that %rowtype is a PL/SQL'ism that does not work outside of PL/SQL.
    However, the 11g version of the provider introduced User Defined Types (UDTs) which may be helpful depending on your requirements, etc.
    2.)Cursors generally slow down your db(Iam from microsoft sql server back ground). But we seem to be using ref cursors quite a lot here.The only way to return a result as far as i have seen in oracle is to use a ref cursor.Is there any other way?
    Using a ref cursor is the way to return a result set from PL/SQL to a client. If you are not using PL/SQL then you would not use a ref cursor.
    The .NET Developer Center has good information:
    http://www.oracle.com/technology/tech/dotnet/index.html
    Regards,
    Mark

  • Can I retrieve a result set from Oracle and then incorporate that result set into my main SQL Server Stored Procedure?

    So I have a chunk of data that only resides in Oracle. So I need to capture that information from Oracle. Now before you get over zealous, I did try with an OPENQUERY and it took FOREVER! And I don't know why the OPENQUERY took FOREVER but if I run the same
    query directly against Oracle it runs very quickly...like 20 seconds.
    So now I'm wondering...can I build a dataset in my SSRS Report that uses an Oracle Data source and an Oracle Stored Procedure in its Dataset that I'll create to aggregate this subset of data and then utilize its result set back in my main reporting
    Dataset that will utilize SQL Server? And how can I do that? Can I make my main Dataset reference, say, a #TemporaryTable that is created from my Oracle Dataset in its
    I'll continue to Google a few things as I await your review and hopefully a reply.
    Thanks in advance for your help.

    Hi ITBobbyP,
    According to your description you want to use data from a Oracle data source into a DataSet which retrieving data from SQL Server. Right?
    In Reporting Services, we can have multiple data sources in one project pointing to different database. And we can use separated dataset to retrieve data from different data source. However, it's not supported to combine the two datasets together
    directly. We can only use Lookup(), LookupSet() function to combine fields from different dataset into one tablix when there are common columns between two datasets. This is the only way to make tow result sets together in SSRS.
    Reference:
    Lookup Function (Report Builder and SSRS)
    LookupSet Function (Report Builder and SSRS)
    Best Regards, 
    Simon Hou
    TechNet Community Support

  • I cannot display image (read from oracle BLOB field) on browser?

    I cannot display image (read from oracle BLOB field) on browser?
    Following is my code, someone can give me an advise?
    content.htm:
    <html>
    <h1>this is a test .</h1>
    <hr>
    <img  src="showcontent.jsp">
    </html>showcontent.jsp:
    <%@ page import="com.stsc.util.*" %>
    <%@ include file="/html/base.jsp" %>
    <% 
         STDataSet data = new STDataSet();
    //get blob field from database     
         String sql = "SELECT NR FROM ZWTAB WHERE BZH='liqf004' AND ZJH='001'";
         //get the result from database
         ResultSet rs = data.getResult(sql,dbBase);
         if (rs!=null && rs.next()) {
              Blob myBlob = rs.getBlob("NR");
              response.setContentType("image/jpeg");//
              byte[] ba = myBlob.getBytes(1, (int)myBlob.length());
              response.getOutputStream().write(ba);
              response.getOutputStream().flush();
         // close your result set, statement
         data.close();     
    %>

    Don't use jsp for that, use servlet. because the jsp engine will send a blank lines to outPutStream corresponding to <%@ ...> tags and other contents included in your /html/base.jsp file before sending the image. The result will not be treated as a valid image by the browser.
    To test this, type directly showcontent.jsp on your browser, and view it source.
    regards

  • Image from Oracle BLOB is not showing

    Hi all!
    Im trying to use this code:
    <?php
    //... etc
    $sql = oci_parse($c, 'select * from pf2.documents ');
    oci_execute($sql);
    echo "<table width = 200 border = 1 cellspacing=0 cellpadding=0>";
    while ($row = oci_fetch_assoc($sql)) {
    echo "<tr>";
    echo"<td style=background-color:#DDDEEE; align=center>";
    echo $row['SHORTNAME'] ;
    echo"</td>";
    echo"<td style=background-color:#DDDEEE; align=center>";
    print $row['FILENAME'] ->load();
    echo"</td>";
    echo "</tr>";
    echo "</table>";
    //... etc
    ?>
    Here im trying to select and publish an image from Oracle BLOB,
    but in Mozilla Firefox im getting just whong text:
    яШяа�JFIF��`�`��яЫ�C� $.' ",#(7),01444'9=82<.342яЫ�C 2!!22222222222222222222222222222222222222222222222222яА�МЂ"�яД����������� яД�µ���}�!1AQa"q2Ѓ‘Ў#B±БRСр$3br‚ %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyzѓ„…†‡€‰Љ’“”•–—�™љўЈ¤Ґ¦§Ё©ЄІіґµ¶·ё№єВГДЕЖЗИЙКТУФХЦЧШЩЪбвгдежзийкстуфхцчшщъяД�������� яД�µ��w�!1AQaq"2ЃB‘Ў±Б #3RрbrС $4б%с
    Please help!
    P.S.: Im using PHP 5.2.10 under Wintel platform,
    Oracle 9.2.0.4,
    create table DOCUMENTS
    DOCID NUMBER(10) not null,
    SHORTNAME VARCHAR2(30) not null,
    FULLNAME VARCHAR2(250) not null,
    FILENAME BLOB not null,
    AUTHOR VARCHAR2(30) not null,
    CREATIONDT DATE not null,
    VERSION VARCHAR2(10) not null
    Edited by: user502299 on 28.09.2009 5:33

    I am having a similiar problem. I have created the image.php file:
    <?
    $query = "select a.image_file FROM officer_image a, officer_info b where a.officer_id=b.officer_id and b.officer_lname like 'LEDEZ%' ";
    $stmt = @OCIParse ($db_conn, $query);
    @OCIExecute($stmt, OCI_DEFAULT);
    @OCIFetchInto($stmt, $arr, OCI_ASSOC+OCI_RETURN_LOBS);
    $result = $arr['BLOB'];
    @OCIFreeStatement($stmt);
    @OCILogoff($conn);
    $im = @imagecreatefromstring ($result);
    if (!$im) {
    $im = imagecreate(150, 30);
    $bgc = imagecolorallocate($im, 255, 255, 255);
    $tc = imagecolorallocate($im, 0, 0, 0);
    imagefilledrectangle($im, 0, 0, 150, 30, $bgc);
    imagestring($im, 1, 5, 5, "", $tc);
    Header("Content-type: image/jpeg");
    Header("Content-Disposition: attachment; filename=filename_".uniqid(time()).".jpg");
    imagejpeg($im,'',100);
    imagedestroy($im);
    ?>
    And then in the actual search web page:
    <?php
              $tname = $_POST['lname'];
              $lname = "{$tname}%";
              $id = "1";
              //$query = "SELECT officer_id, image_file FROM officer_image WHERE ID='.$id.'";
              $query = "select a.image_file FROM officer_image a, officer_info b where a.officer_id=b.officer_id and b.officer_lname like 'LEDEZ%' ";
              //oci_bind_by_name($sql, ":bv", $lname);
              //oci_execute($sql);
              $stid = OCIParse($conn,$query);
              Header("content-type:image/jpeg");
              OCIExecute($stid, OCI_DEFAULT);
              while($succ= OCIFetchInto($stid,$row)) {
                   foreach($row as $item) {
         $blob_message = $item->load();
                   // Output the image
              //imagejpeg($blob_message);
              echo $blob_message . " " ;
              //echo "<img src="image.php?id='.$blob_message.'" border="0">. $rows['officer_id']."\">\n";
              echo "<br /><br />";
                   // Free up memory
              //imagedestroy($im);
              //while ($row = oci_fetch_assoc($sql))
    ?>
    Can anyone help?

  • Error when reading BLOB field from Oracle usin Toplink

    We experience a very annoying problem when trying to read a BLOB
    field from Oracle 8.1.6.2.0 using TOPLink 3.6.3. I have attached the
    exception stack trace that is reported to the console. As far as I can
    judge a fault at oracle.sql.LobPlsqlUtil.plsql_length() happens first and
    then at TOPLink.Private.DatabaseAccess.DatabasePlatform.convertObject().
    The exception is permanently repeating that is very critical for us.
    ServerSession(929808)--Connection(5625701)--SELECT LOBBODY, ID, LABEL, FK_OBJECT_ID, FK_OBJECTTYPE FROM NOTE WHERE (ID = 80020)
    INTERNAL EXCEPTION STACK:
    java.lang.NullPointerException
    at oracle.sql.LobPlsqlUtil.plsql_length(LobPlsqlUtil.java:936)
    at oracle.sql.LobPlsqlUtil.plsql_length(LobPlsqlUtil.java:102)
    at oracle.jdbc.dbaccess.DBAccess.lobLength(DBAccess.java:709)
    at oracle.sql.LobDBAccessImpl.length(LobDBAccessImpl.java:58)
    at oracle.sql.BLOB.length(BLOB.java:71)
    at TOPLink.Private.Helper.ConversionManager.convertObjectToByteArray(ConversionManager.java:309)
    at TOPLink.Private.Helper.ConversionManager.convertObject(ConversionManager.java:166)
    at TOPLink.Private.DatabaseAccess.DatabasePlatform.convertObject(DatabasePlatform.java:594)
    at TOPLink.Public.Mappings.SerializedObjectMapping.getAttributeValue(SerializedObjectMapping.java:43)
    at TOPLink.Public.Mappings.DirectToFieldMapping.valueFromRow(DirectToFieldMapping.java:490)
    at TOPLink.Public.Mappings.DatabaseMapping.readFromRowIntoObject(DatabaseMapping.java:808)
    at TOPLink.Private.Descriptors.ObjectBuilder.buildAttributesIntoObject(ObjectBuilder.java:173)
    at TOPLink.Private.Descriptors.ObjectBuilder.buildObject(ObjectBuilder.java:325)
    at TOPLink.Private.Descriptors.ObjectBuilder.buildObjectsInto(ObjectBuilder.java:373)
    at TOPLink.Public.QueryFramework.ReadAllQuery.execute(ReadAllQuery.java:366)
    at TOPLink.Public.QueryFramework.DatabaseQuery.execute(DatabaseQuery.java:406)
    I have started the application with Oracle JDBC logging on and found that the problem may originate in a possible lack of syncronization in the pooled connection implementation:
    DRVR FUNC OracleConnection.isClosed() returned false
    DRVR OPER OracleConnection.close()
    DRVR FUNC OracleConnection.prepareCall(sql)
    DRVR DBG1 SQL: "begin ? := dbms_lob.getLength (?); end;"
    DRVR FUNC DBError.throwSqlException(errNum=73, obj=null)
    DRVR FUNC DBError.findMessage(errNum=73, obj=null)
    DRVR FUNC DBError.throwSqlException(reason="Logical handle no longer valid",
    SQLState=null, vendorCode=17073)
    DRVR OPER OracleConnection.close()
    so the prepareCall() is issued against an already closed connection and the
    call fails.
    I assume we have been using a JDBC 2.0 compliant driver. We tried out
    drivers that Oracle supplies for 8.1.6, 8.1.7 versions. To be true I
    couldn't find any information about the JDBC specification they conform to. Does it
    mean that these drivers may not be 100%-compatible with JDBC 2.0 Spec?
    How can I find out if they are 2.0 compliant?
    Also I have downloaded Oracle 9.2.0.1 JDBC drivers. This seemed to work
    fine until we found another incompatibility which made us return back to
    8.1.7 driver:
    UnitOfWork(7818028)--Connection(4434104)--INSERT INTO STATUSHISTORY (CHANGEDATE, FK_SET_STATUS_ID) VALUES ({ts '2002-10-17 16:46:54.529'}, 2)
    INTERNAL EXCEPTION STACK:
    java.sql.SQLException: ORA-00904: invalid column name
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
    at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:289)
    at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:573)
    at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1891)
    at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java:1093
    at oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.jav
    a:2047)
    at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java
    :1940)
    at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatemen
    t.java:2709)
    at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePrepare
    dStatement.java:589)
    at TOPLink.Private.DatabaseAccess.DatabaseAccessor.executeDirectNoSelect(
    DatabaseAccessor.java:906)
    at TOPLink.Private.DatabaseAccess.DatabaseAccessor.executeNoSelect(Databa
    seAccessor.java:960)
    at TOPLink.Private.DatabaseAccess.DatabaseAccessor.executeCall(DatabaseAc
    cessor.java:819)
    at TOPLink.Public.PublicInterface.UnitOfWork.executeCall(UnitOfWork.java:

    Hello Yury,
    I believe the problem is that TopLink's ServerSession by default executes read queries concurrently on the same connection. It does this to reduce the number of required connections for the read connection pool. Normally this is a good concurrency optimization, however some JDBC drivers have issues when this is done. I had thought that with Oracle JDBC 8.1.7 this issue no longer occurred, but perhaps it is only after version 9. I believe that the errors were only with the thin JDBC driver, not the OCI, so using the OCI driver should also resolve the problem. Using RAW instead of BLOB would also work.
    You can configure TopLink to resolve this problem through using exclusive read connection pooling.
    Example:
    serverSession.useExclusiveReadConnectionPool(int minNumerOfConnections, int maxNumerOfConnections);
    This will ensure that TopLink does not to try to concurrently execute read queries on the same connection.
    I'm not exactly sure what your second problem with the 9.x JDBC drivers is. From the SQL and stack trace it would seem that the driver does not like the JDBC timestamp syntax. You can have TopLink print timestamp in Oracle's native SQL format to resolve this problem.
    Example:
    serverSessoin.getLogin().useNativeSQL();
    Make sure you configure your server session before you login, or if using the TopLink Session Manager perform the customizations through a SessionEventListener-preLogin event.

  • Retrieve data from oracle table, table name passed in runtime into JSP

    Hello All,
    I am new to JSP, i have a requirement,
    I need to retrieve data from oracle table, here table is passed at random. how to get the data displayed in JSP page.
    can any one help me in that
    thanks

    1) Learn SQL.
    2) Learn Java.
    3) Learn JDBC.
    4) Learn DAO.
    5) Learn HTTP.
    6) Learn HTML.
    7) Learn JSP/Servlet.
    8) Learn JSTL.
    9) Apply learned things and develop.
    Whenever you stucks, please come back and post the specific coding/technical problem here.

Maybe you are looking for

  • Checkbox functionality

    I have a window in my form that is suppose to open when a checkbox is marked. It does this by having a WHEN-CHECKBOX-CHANGED trigger on the checkbox item. In its PL/SQL block it has an if statement that says if the checkbox is marked then open the wi

  • How can I call a servlet from a javascript

    Hello I have a JSP page that has 2 aim : save and list. I want to use javascript like this to call my save and list methods : <SCRIPT language="JavaScript"> function savedata(){ document.kaydetsorgula.action = "hatBilgisiKaydetKontroller.java"; docum

  • The resize widget || disappeared.  How do I get it back

    The resize widget that I used so often has disappeared on one of my computers.  All my computers run OS X lion 10.7.4.  All but one have the widget. It is handy, because often when a column is too narrow in column view to show an entire file or folde

  • Which receiver to go with?

    I just bought Klipsch HD-500 speakers and now I am looking for a receiver.  Ive narrowed my choices to the Onkyo TX-SR607 and Onkyo TX-SR707.  The 707 model is the next level up but also a few hundred dollars more.  I have a medium size living room w

  • ERROR IN QUERY WHEN EXECUTED

    Hi, I designed a query with a simple AMOUNT keyfigure (It is not a formula nor a Restricted KeyFigure). When I check the query, it seems to be okay, but when i execute it the column of the key figure displays the correct amount but with a ERR in the