Persisting Oracle BLOBs & CLOBs from a CMP Bean

Can someone tell me how to persist Oracle BLOBs and CLOBs from a CMP Bean?
Thanks,
Abel

A link to the answer might be helpful.
Dave
"Abel Rosnovski" <[email protected]> wrote in message
news:[email protected]..
>
>

Similar Messages

  • Accessing XMLType and CLOB from Enterprise Java Beans

    When trying to create a temporary CLOB within the application server the following exception
    occurs (connection from Jndi):
    Oracle9iAS (9.0.2.0.0) Containers for J2EE initialized
    AccessEJBBean.meld: ex=java.lang.NullPointerException java.lang.NullPointerException      
    at oracle.sql.LobPlsqlUtil.plsql_createTemporaryLob(LobPlsqlUtil.java:1352)      
    at oracle.jdbc.dbaccess.DBAccess.createTemporaryLob(DBAccess.java:997)      
    at oracle.sql.LobDBAccessImpl.createTemporaryClob(LobDBAccessImpl.java:240)      
    at oracle.sql.CLOB.createTemporary(CLOB.java:527)      
    at com.access.impl.AccessEJBBean.meld(AccessEJBBean.java:67)      
    (email: [email protected] )

    When trying to create a temporary CLOB within the application server the following exception
    occurs (connection from Jndi):
    Oracle9iAS (9.0.2.0.0) Containers for J2EE initialized
    AccessEJBBean.meld: ex=java.lang.NullPointerException java.lang.NullPointerException      
    at oracle.sql.LobPlsqlUtil.plsql_createTemporaryLob(LobPlsqlUtil.java:1352)      
    at oracle.jdbc.dbaccess.DBAccess.createTemporaryLob(DBAccess.java:997)      
    at oracle.sql.LobDBAccessImpl.createTemporaryClob(LobDBAccessImpl.java:240)      
    at oracle.sql.CLOB.createTemporary(CLOB.java:527)      
    at com.access.impl.AccessEJBBean.meld(AccessEJBBean.java:67)      
    (email: [email protected] )

  • Expoting/Importing Oracle BLOB, CLOB, Nested Tables datatypes

    I am trying to export the database containing BLOB, Nested Tables etc. and wants to import the same. But i am getting an error. Pleease help as to how i will proceed with it. This is something very urgent. please reply . i will be very thankful to you

    I believe this error is only associated with LONG data type. I have been using data pump to export/import table with LOB type without any problem.
    Data pump been having issue with LONG type check this bug
    Bug 5598333 - EXPDP/IMPDP corrupts the data for a LONG column
    Doc ID: Note:5598333.8
    It's fixed in 11.1.0.6

  • Wrong exception being thrown on CMP bean error

    In OC4J Release 2 I'm getting the wrong exception thrown from a CMP bean error.
    Situation:
    Servlet calls an update method on a stateless session bean with trans-attribute of Required. This update method finds 2 entity beans by primary key and updates both of them (all with trans-attribute of Supports). When an error is thrown in the second entity bean (by trying to set a value to something that breaks a constraint), I get the following error:
    com.evermind.server.rmi.OrionRemoteException: Transaction was rolled back: Error preparing bean instance: com.evermind.transaction.MarshallingXAException
    at TestSession_StatefulSessionBeanWrapper3.updatebothtests(TestSession_StatefulSessionBeanWrapper3.java:1164)
    at __jspPage1_insertEntityTest_jsp._jspService(__jspPage1_insertEntityTest_jsp.java:224)
    at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
    at com.evermind.server.http.HttpApplication.serviceJSP(HttpApplication.java:5680)
    at com.evermind.server.http.JSPServlet.service(JSPServlet.java:31)
    at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:667)
    at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:269)
    at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:702)
    at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:250)
    at com.evermind.util.ThreadPoolThread.run(ThreadPoolThread.java:62)
    Nested exception is:
    com.evermind.transaction.MarshallingXAException
    at com.evermind.server.ejb.EntityEJBObject.prepare(EntityEJBObject.java:70)
    at com.evermind.server.ApplicationServerTransactionSynchronization.prepareComponentsSuccess(ApplicationServerTransactionSynchronization.java:403)
    at com.evermind.server.ApplicationServerTransactionSynchronization.beforeCompletion(ApplicationServerTransactionSynchronization.java:565)
    at com.evermind.server.ApplicationServerTransaction.beforeCompletion(ApplicationServerTransaction.java:1063)
    at com.evermind.server.ApplicationServerTransaction.commit(ApplicationServerTransaction.java:552)
    at com.evermind.server.ApplicationServerTransaction.end(ApplicationServerTransaction.java:834)
    at TestSession_StatefulSessionBeanWrapper3.updatebothtests(TestSession_StatefulSessionBeanWrapper3.java:1160)
    at __jspPage1_insertEntityTest_jsp._jspService(__jspPage1_insertEntityTest_jsp.java:224)
    at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
    at com.evermind.server.http.HttpApplication.serviceJSP(HttpApplication.java:5680)
    at com.evermind.server.http.JSPServlet.service(JSPServlet.java:31)
    at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:667)
    at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:269)
    at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:702)
    at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:250)
    at com.evermind.util.ThreadPoolThread.run(ThreadPoolThread.java:62)
    Nested exception is:
    java.lang.InternalError: Werent current caller, server stacktrace (to disable this message, use -Dejb.assert=false at startup): java.lang.Throwable: Werent current caller
    at Test2_EntityBeanWrapper5.setEntityBean(Test2_EntityBeanWrapper5.java:1496)
    at com.evermind.server.ejb.EntityEJBHome.passivateAndRelease(EntityEJBHome.java:344)
    at com.evermind.server.ejb.EntityEJBObject.releaseContext(EntityEJBObject.java:378)
    at Test2_EntityBeanWrapper5.saveState(Test2_EntityBeanWrapper5.java:1442)
    at com.evermind.server.ejb.EntityEJBObject.prepare(EntityEJBObject.java:39)
    at com.evermind.server.ApplicationServerTransactionSynchronization.prepareComponentsSuccess(ApplicationServerTransactionSynchronization.java:403)
    at com.evermind.server.ApplicationServerTransactionSynchronization.beforeCompletion(ApplicationServerTransactionSynchronization.java:565)
    at com.evermind.server.ApplicationServerTransaction.beforeCompletion(ApplicationServerTransaction.java:1063)
    at com.evermind.server.ApplicationServerTransaction.commit(ApplicationServerTransaction.java:552)
    at com.evermind.server.ApplicationServerTransaction.end(ApplicationServerTransaction.java:834)
    at TestSession_StatefulSessionBeanWrapper3.updatebothtests(TestSession_StatefulSessionBeanWrapper3.java:1160)
    at __jspPage1_insertEntityTest_jsp._jspService(__jspPage1_insertEntityTest_jsp.java:224)
    at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
    at com.evermind.server.http.HttpApplication.serviceJSP(HttpApplication.java:5680)
    at com.evermind.server.http.JSPServlet.service(JSPServlet.java:31)
    at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:667)
    at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:269)
    at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:702)
    at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:250)
    at com.evermind.util.ThreadPoolThread.run(ThreadPoolThread.java:62) at Test2_EntityBeanWrapper5.setEntityBean(Test2_EntityBeanWrapper5.java:1496)
    at com.evermind.server.ejb.EntityEJBHome.passivateAndRelease(EntityEJBHome.java:344)
    at com.evermind.server.ejb.EntityEJBObject.releaseContext(EntityEJBObject.java:378)
    at Test2_EntityBeanWrapper5.saveState(Test2_EntityBeanWrapper5.java:1442)
    at com.evermind.server.ejb.EntityEJBObject.prepare(EntityEJBObject.java:39)
    at com.evermind.server.ApplicationServerTransactionSynchronization.prepareComponentsSuccess(ApplicationServerTransactionSynchronization.java:403)
    at com.evermind.server.ApplicationServerTransactionSynchronization.beforeCompletion(ApplicationServerTransactionSynchronization.java:565)
    at com.evermind.server.ApplicationServerTransaction.beforeCompletion(ApplicationServerTransaction.java:1063)
    at com.evermind.server.ApplicationServerTransaction.commit(ApplicationServerTransaction.java:552)
    at com.evermind.server.ApplicationServerTransaction.end(ApplicationServerTransaction.java:834)
    at TestSession_StatefulSessionBeanWrapper3.updatebothtests(TestSession_StatefulSessionBeanWrapper3.java:1160)
    at __jspPage1_insertEntityTest_jsp._jspService(__jspPage1_insertEntityTest_jsp.java:224)
    at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
    at com.evermind.server.http.HttpApplication.serviceJSP(HttpApplication.java:5680)
    at com.evermind.server.http.JSPServlet.service(JSPServlet.java:31)
    at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:667)
    at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:269)
    at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:702)
    at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:250)
    at com.evermind.util.ThreadPoolThread.run(ThreadPoolThread.java:62)
    Why am I getting a MarshallingXAException instead of a SQLException? In the old OC4J, I got a SQLException wrapped in an OrionRemoteException, with the details of what constraint was broken, instead of this.
    I've also duplicated this by doing the entity bean updates directly from the servlet wrapped in a UserTransaction.
    Jeff.

    Tell me whether your transaction has been rolled back or not....If it has been rolled back, then those messages, printed on your server console are debug messages...just ignore them...
    After this exception, can u able to execute other applications in OC4J?
    --Venky                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Can I use oracle blob by CMP bean in weblogic 6?

    I use weblogic 6.1(sp3) and Jbuilder 7.when I try to use oracle blob by CMP bean,the
    errors are:
    javax.ejb.FinderException: Exception raised in findByPrimaryKey
    java.io.StreamCorruptedException: InputStream does not contain a serialized object
    What should I do?Is there examples about using oracle blob?
    thanks a lot!

    Great! So what was the problem?
    Regards,
    Slava Imeshev
    "Roger Lee" <[email protected]> wrote in message
    news:[email protected]...
    >
    Finally got it working with CMP, which is my preferred choice (over BMP).
    I read the Excel Spreadsheet into a "byte []" array, and the Entity Beanmapped
    "byte []" to the Blob column in the Oracle table.
    "Slava Imeshev" <[email protected]> wrote:
    Roger,
    I'm not quite sure I undestand the problem. Could you:
    1. Post deployment descriptors in part related to this
    CMP bean?
    2. Post the piece of code that is failing?
    Please post the information above and we will help
    you to hunt the problem down.
    No, I don't have any problems accessing blobs
    from CMP.
    Regards,
    Slava Imeshev
    "Roger Lee" <[email protected]> wrote in message
    news:[email protected]...
    Yes. I have added;
    <dbms_column-type>OracleBlob</dbms-column-type>
    It fails because the locater to the blob, obtained by findBYPrimaryKeyis
    null.
    i.e. an empty_blob() is not created.
    Have you got CMP to access Blobs in WLS 6.1?
    "Slava Imeshev" <[email protected]> wrote:
    Hi Roger,
    Have you tried using OracleBlob as dbms-column-type?
    Also, could you post that part of your code that is failing?
    Regards,
    Slava Imeshev
    "Roger Lee" <[email protected]> wrote in message
    news:[email protected]...
    I can access Clobs using CMP. If you are using the Oracle OCI Driveryou
    do not
    need to add this line.
    However if you are using the Oracle Type 4 Thin drivers you need
    to
    add;
    <dbms_column-type>OracleClob</dbms-column-type>
    to the file;
    weblogic-cmp-rdbms-jar-xml
    This DOES NOT work with Blobs.
    I am unable to get WebLogic 6.1 sp4 persist a Blob to an Oracle
    8.1.x
    table and
    retrieve it using either CMP or BMP.
    Unless any one show me a complete working CMP and BMP example?
    Roger Lee
    Deepak Vohra <[email protected]> wrote:
    BLOB and CLOB DBMS Column Support for the Oracle DBMS
    http://edocs.bea.com/wls/docs61/ejb/cmp.html#1061636
    shybird wrote:
    I use weblogic 6.1(sp3) and Jbuilder 7.when I try to use oracle
    blob
    by CMP bean,the
    errors are:
    javax.ejb.FinderException: Exception raised in findByPrimaryKey
    java.io.StreamCorruptedException: InputStream does not contain
    a
    serialized
    object
    What should I do?Is there examples about using oracle blob?
    thanks a lot!

  • Handling BLOBs with CMP Beans

    Hi,
    is there a detailed example how to handle Blob's with CMP Beans?
    I'm trying to store some images in a database (Oracle 9i) using CMP Beans and Oracle iAS 9.03 and jdk 1.4.
    Thanks in advance
    Jens

    We are currently developing a How-To on this and will put this on OTN.
    1) Code snippet from Bean Class:
    public abstract byte[] getPicture();
    public abstract void setPicture(byte[] newPicture);
    public Long ejbCreate(Long empno, byte[] newPicture)
    setEmpno(empno);
    setPicture(newPicture);
    return empno;
    public void ejbPostCreate(Long empno, byte[] newPicture)
    2) Mapping in the orion-ejb-jar.xml:
    <entity-deployment name="EmployeePicture" data-source="jdbc/OracleDS" table="EMPPIC">
    <primkey-mapping>
    <cmp-field-mapping name="empno" persistence-name="EMPNO" persistence-type="NUMBER(8)"/>
    </primkey-mapping>
    <cmp-field-mapping name="empno" persistence-name="EMPNO" persistence-type="NUMBER(8)"/>
    <cmp-field-mapping name="picture" persistence-name="PICTURE" persistence-type="BLOB(4000)"/>
    </entity-deployment>
    3) Create the client to create the bean:
    Long empNo =(Long) Long.valueOf(request.getParameter("EmpNo"));
    String fileName =request.getParameter("ImageFileName");
    InputStream is = new BufferedInputStream(new FileInputStream(fileName));
    int len;
    // Initialize byte array
    byte byteValue[] = new byte[2048000];
    len = is.read(byteValue);
    EmployeePictureLocal employeePicture = empHome.create(empNo , byteValue);
    out.println("Picture of Emp#:"+empNo +" successfully Loaded into DB <br> <br>");
    4) Code snippet to view the image :
    Long empNo =(Long) Long.valueOf(request.getParameter("EmpNo"));
    out.println("Picture of Emp#"+empNo);
    EmployeePictureLocal emp = empHome.findByPrimaryKey(empNo);
    response.setContentType("image/jpeg");
    OutputStream os = null;
    os = response.getOutputStream() ;
    byte[] pic = emp.getPicture();
         os.write(pic);
    os.close();
    os = null;
    Let me know if this helps
    thanks
    Debu

  • Cmp beans generated from rose

    hi all;
    i have a uml diagram with two classes (matser-detail). i generated the corresponding tables into oracle 9i database from rational rose.
    using jdeveloper. when create cmp beans from this two tables, i deploy it works fine
    but when i add my finder method (findByID) in ejbql i wrote:
    select object(e) from employees e where e.employee_id=?1
    i try to deploy again and i have the following error:
    javax.ejb.EJBException: nested exception is: java.lang.StringIndexOutOfBoundsException: String index out of range: -1
    java.lang.StringIndexOutOfBoundsException: String index out of range: -1
         at java.lang.String.substring(String.java:1525)
         at com.sun.ejb.sqlgen.SQLGenerator.generateCreateTableQuery(SQLGenerator.java:530)
         at com.sun.ejb.sqlgen.SQLGenerator.<init>(SQLGenerator.java:240)
         at com.sun.ejb.sqlgen.SQLGenerator.generateSQL(SQLGenerator.java:360)
         at com.sun.ejb.sqlgen.SQLGenerator.generateSQL(SQLGenerator.java:309)
         at com.evermind.server.ejb.deployment.EJBPackage.translateEjbqlQeries(EJBPackage.java:2100)
         at com.evermind.server.ejb.compilation.Compilation.translateEjbqlQeries(Compilation.java:140)
         at com.evermind.server.ejb.compilation.Compilation.compile(Compilation.java:178)
         at com.evermind.server.administration.ServerApplicationInstallation.finish(ServerApplicationInstallation.java:526)
         at java.lang.reflect.Method.invoke(Native Method)
         at com.evermind.server.rmi.RMICallHandler.run(RMICallHandler.java:119)
         at com.evermind.server.rmi.RMICallHandler.run(RMICallHandler.java:48)
         at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:803)
         at java.lang.Thread.run(Thread.java:484)
    javax.ejb.EJBException: nested exception is: java.lang.StringIndexOutOfBoundsException: String index out of range: -1
         at com.sun.ejb.sqlgen.SQLGenerator.<init>(SQLGenerator.java:255)
         at com.sun.ejb.sqlgen.SQLGenerator.generateSQL(SQLGenerator.java:360)
         at com.sun.ejb.sqlgen.SQLGenerator.generateSQL(SQLGenerator.java:309)
         at com.evermind.server.ejb.deployment.EJBPackage.translateEjbqlQeries(EJBPackage.java:2100)
         at com.evermind.server.ejb.compilation.Compilation.translateEjbqlQeries(Compilation.java:140)
         at com.evermind.server.ejb.compilation.Compilation.compile(Compilation.java:178)
         at com.evermind.server.administration.ServerApplicationInstallation.finish(ServerApplicationInstallation.java:526)
         at java.lang.reflect.Method.invoke(Native Method)
         at com.evermind.server.rmi.RMICallHandler.run(RMICallHandler.java:119)
         at com.evermind.server.rmi.RMICallHandler.run(RMICallHandler.java:48)
         at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:803)
         at java.lang.Thread.run(Thread.java:484)
    com.evermind.compiler.CompilationException: Error translating EJBQL: javax.ejb.EJBException: nested exception is: java.lang.StringIndexOutOfBoundsException: String index out of range: -1
         at com.evermind.server.ejb.compilation.Compilation.translateEjbqlQeries(Compilation.java:143)
         at com.evermind.server.ejb.compilation.Compilation.compile(Compilation.java:178)
         at com.evermind.server.administration.ServerApplicationInstallation.finish(ServerApplicationInstallation.java:526)
         at java.lang.reflect.Method.invoke(Native Method)
         at com.evermind.server.rmi.RMICallHandler.run(RMICallHandler.java:119)
         at com.evermind.server.rmi.RMICallHandler.run(RMICallHandler.java:48)
         at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:803)
         at java.lang.Thread.run(Thread.java:484)
    nb: when i use the HR schema coming with 9i it works fine.
    need help

    I presume you are getting the problem on application
    deploy? This happens when upon initialization of the application using the built-in OC4J container/app server that is part of JDeveloper. Here is the full messaging:
    [Starting OC4J using the following ports: HTTP=8989, RMI=23892, JMS=9228.]
    C:\OraHome1\jdk\bin\javaw.exe -ojvm -classpath C:\OraHome1\j2ee\home\oc4j.jar com.evermind.server.OC4JServer -config C:\OraHome1\jdev\system\oc4j-config\server.xml
    [waiting for the server to complete its initialization...]
    Copying default deployment descriptor from archive at Q:\CBTCOF\COF_APPLICATION\COF_Project\classes/META-INF/orion-ejb-jar.xml to deployment directory C:\OraHome1\jdev\system\oc4j-config\application-deployments\current-workspace-app\classes...
    Auto-deploying file:/Q:/CBTCOF/COF_APPLICATION/COF_Project/classes/ (No previous deployment found)...
    Auto-creating table: create table STREET_TYPE (PK_STYP_ID NUMBER(8), STREET_TYPE VARCHAR2(20), primary key (PK_STYP_ID, STREET_TYPE))
    Warning: Error creating table: ORA-00955: name is already used by an existing object
    [...OTHER SIMILAR ERROR MESSAGES]
    done.
    Oracle9iAS (9.0.2.0.0) Containers for J2EE initialized
    If so, in the application.xml file of you
    OC4J instance the is a setting autocreate-tables,
    which by default is true!
    Set it to false as below and that should clear up
    your problem.
    <orion-application autocreate-tables="false"
    default-data-Hmm. I found at least a dozen or so files with that name and set everyone that had this attriute to "false", restarted the OC4J server and still got these errors.

  • Problem finding data in an Oracle Database using CMP beans

    I am having a problem retrieving data from an Oracle database that has a date as
    part of the key. This data was loaded into my database via a batch process writing
    in java using java.sql.Date to store the date information. When calling the findByPrimaryKey
    method of a CMP Entity Bean I continued to get the FinderException. I know this
    data is in my database because I can view the data via SQLPlus and Microsoft Access.
    Has anyone ever experience problems with CMP beans accessing data from an Oracle
    database that had a date as part if the key or with accessing data in the database
    that insert via another method outside of your CMP bean. I desperately need some
    answers.

    Hi Dave,
    You should probably post this type of question in the CMP or JDBC section
    for best results. Chances are that the date is suffering from a rounding
    problem (it could be a date/time in the database with a different time zone)
    or is not the date that you think it is (wrong century or millenium). I've
    seen both. You need to write a quick piece of code that loads in those
    values as both Java timestamps and dates and makes sure that they are what
    you think they are.
    Peace,
    Cameron Purdy
    Tangosol Inc.
    Tangosol Coherence: Clustered Coherent Cache for J2EE
    Information at http://www.tangosol.com/
    "Dave White" <[email protected]> wrote in message
    news:3c1a4ac3$[email protected]..
    >
    I am having a problem retrieving data from an Oracle database that has adate as
    part of the key. This data was loaded into my database via a batchprocess writing
    in java using java.sql.Date to store the date information. When callingthe findByPrimaryKey
    method of a CMP Entity Bean I continued to get the FinderException. Iknow this
    data is in my database because I can view the data via SQLPlus andMicrosoft Access.
    Has anyone ever experience problems with CMP beans accessing data from anOracle
    database that had a date as part if the key or with accessing data in thedatabase
    that insert via another method outside of your CMP bean. I desperatelyneed some
    answers.

  • HOW TO GET THE SQLEXCEPTION FROM CMP BEAN

    Hi All,
    I am using CMP Bean as back end in my application.My client class access the CMP Bean to Create or Update the records via Session Facade.In My Database i am using trigger to avoid the concurrent updation.So when the concurrent calls made the database triigger will throw ERROR ..It works fine....But in EJB all the Exception will be thrown as RemoteException.
    But my problem is container will always throws Remote Exception to the client .I need get the actual SQL EXCEPTION (SQL STATE)thrown from the database.I have used the printStackTrace() method to print it in my Console..It work fine..I need to covert this as String ..So that only i can compare the String and can tell the End User what is the Error.....
    when i convert this exception as String by Using the following Code -
    Client.Java
    try {
    ///I am calling the CMP Bean here via Session Facade
    } catch (RemoteException e) {
    String actualExc = null;
    StringWritter sw = new StringWriter();
    PrintWriter pw = new PrintWriter(sw);
    e.printStackTrace(pw); //This call prints the exception in console
    actualExc = sw.toString();///This string returns only the Stack levels classes ..Not the Exception.(I NEED THE FULL EXCEPTION DETAILS TO THIS STRING )
    How to convert this printStackTrace() exception into String ......Please if u need any other details i will give u..Any idea about this..
    Please reply me....

    Thanks for the reply. Is there any other way to get the actual exception thrown from the database level in CMP bean. Because i am getting only the RemoteException in Client. I am Using Whepshere/DB2.

  • Problems accessing fields in a CMP entity bean from a session bean

    Hello everybody,
    I'm getting the next problem: when I try to access a field in a CMP entity bean that I have instantiated from a session bean (trhoug entitybean.getNameOfField), I get the error "the entity bean does not exist in the database".
    This entity bean is accessing a table in an external database (not the DB of the WAS), but I know that it's getting the correct data from the table, since  I check the entitybean.size() and the entitybean.findByPrimaryKey(), and I get the right information. For some reason, the only thing that it doesn't work in the entity bean are the getter/setter methods (I created them automatically after having created the entity fields).
    I access the entity bean through its local interface...
    I know it's really difficult to give an answer with so few details, but... does anybody think I forgot something important to configure??
    Thank very much in advance!!
    Isidro

    getter and setter methods for cmp-fields are abstract.
    getter and setter methods for cmr-fields are abstract.
    "John Lee" <[email protected]> wrote:
    >
    Hi:
    Which method in a CMP Entity bean should be abstract? just only SetXXX
    and
    GetXXX?
    Thanks!
    John Lee

  • Error While reading CLOB from Oracle using WebLogic Connection Pool, Works fine with out using pool

    PROBLEM DESCRIPTION :
         When I try to read a clob from Oracle, I receive "ORA-03120: two-task
    conversion routine: integer overflow" Error.
         This error occurs only for CLOB Type and only if I try to connect to
    Oracle using WebLogic JDriver/Oracle POOL.
         IMPORTANT NOTE: I can read CLOB or any other data using direct JDBC
    connection to ORacle with out any problem.
         Below Please find the JAVA CODE for Both Working and NON Working .
    Created a Connection Pool as:
    Name: MyJDBCConnectionPool
    URL : jdbc:weblogic:oracle
    DIRVER:weblogic.jdbc.oci.Driver
    NON WORKING JAVA CODE (USES WEBLOGIC JDBC CONNECTION POOL TO ORACLE):
    Driver myDriver =
    (Driver)Class.forName("weblogic.jdbc.pool.Driver").newInstance();
    Connection mconn =
    myDriver.connect("jdbc:weblogic:pool:MyJDBCConnectionPool",null);
    mconn.setAutoCommit (false);
    CallableStatement cs = mconn.prepareCall("{call
    P_XMLTEST2(?)}"); //This returns a CLOB
    cs.registerOutParameter(1,java.sql.Types.CLOB);
    cs.execute();
    Clob clob = null;
    clob = cs.getClob(1);
    String data =new String();
    data = clob.getSubString(1, (int)clob.length());
    System.out.println(data); //print the data
    data = null;
    clob=null;
    cs.close();
    WORKING JAVA CODE (USES DIRECT THIN JDBC CONNECTION TO ORACLE):
    Driver myDriver =
    (Driver)Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
    Connection mconn =
    myDriver.connect("jdbc:oracle:thin:@server:1521:DB",null);
    mconn.setAutoCommit (false);
    CallableStatement cs = mconn.prepareCall("{call
    P_XMLTEST2(?)}"); //This returns a CLOB
    cs.registerOutParameter(1,java.sql.Types.CLOB);
    cs.execute();
    Clob clob = null;
    clob = cs.getClob(1);
    String data =new String();
    data = clob.getSubString(1, (int)clob.length());
    System.out.println(data); //print the data
    data = null;
    clob=null;
    cs.close();
    ERROR MESSAGE:
         ORA-03120: two-task conversion routine: integer overflow
    I appreciate your help on this problem.

    PROBLEM DESCRIPTION :
         When I try to read a clob from Oracle, I receive "ORA-03120: two-task
    conversion routine: integer overflow" Error.
         This error occurs only for CLOB Type and only if I try to connect to
    Oracle using WebLogic JDriver/Oracle POOL.
         IMPORTANT NOTE: I can read CLOB or any other data using direct JDBC
    connection to ORacle with out any problem.
         Below Please find the JAVA CODE for Both Working and NON Working .
    Created a Connection Pool as:
    Name: MyJDBCConnectionPool
    URL : jdbc:weblogic:oracle
    DIRVER:weblogic.jdbc.oci.Driver
    NON WORKING JAVA CODE (USES WEBLOGIC JDBC CONNECTION POOL TO ORACLE):
    Driver myDriver =
    (Driver)Class.forName("weblogic.jdbc.pool.Driver").newInstance();
    Connection mconn =
    myDriver.connect("jdbc:weblogic:pool:MyJDBCConnectionPool",null);
    mconn.setAutoCommit (false);
    CallableStatement cs = mconn.prepareCall("{call
    P_XMLTEST2(?)}"); //This returns a CLOB
    cs.registerOutParameter(1,java.sql.Types.CLOB);
    cs.execute();
    Clob clob = null;
    clob = cs.getClob(1);
    String data =new String();
    data = clob.getSubString(1, (int)clob.length());
    System.out.println(data); //print the data
    data = null;
    clob=null;
    cs.close();
    WORKING JAVA CODE (USES DIRECT THIN JDBC CONNECTION TO ORACLE):
    Driver myDriver =
    (Driver)Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
    Connection mconn =
    myDriver.connect("jdbc:oracle:thin:@server:1521:DB",null);
    mconn.setAutoCommit (false);
    CallableStatement cs = mconn.prepareCall("{call
    P_XMLTEST2(?)}"); //This returns a CLOB
    cs.registerOutParameter(1,java.sql.Types.CLOB);
    cs.execute();
    Clob clob = null;
    clob = cs.getClob(1);
    String data =new String();
    data = clob.getSubString(1, (int)clob.length());
    System.out.println(data); //print the data
    data = null;
    clob=null;
    cs.close();
    ERROR MESSAGE:
         ORA-03120: two-task conversion routine: integer overflow
    I appreciate your help on this problem.

  • Display a BLOB data from Oracle in the browser

    Hello,
    I am trying to display Oracle BLOB(ie ORDSYS.ORDVIR) directly in the browser using ASP.
    It is working in SQL Server, but Oracle seems to be giving a problem...
    The code written in ASP is as follows :
    <%
    'Clear out the existing HTTP header Response.Expires = 0
    Response.Buffer = TRUE
    Response.Clear
    ' Change the HTTP header to reflect that an image is being passed.
    Response.ContentType = "image/jpeg"
    Set cn = Server.CreateObject("ADODB.Connection")
    cn.Open "UID=cbir;PWD=cbir;DSN=trying"
    ' Here thumbnaildata is of type ORDSYS.ORDVIR
    SQLQuery = "SELECT thumbnaildata from image where imagekey='1.JPG'"
    set rsBlob = cn.Execute(SQLQuery)
    Response.BinaryWrite rsBlob(0)
    rsBlob.Close
    Set rsBlob = Nothing
    Response.End
    %>
    The the following is displayed in the browser
    after the asp is executed...
    <font face="Arial" size=2>
    <p>Provider</font> <font face="Arial" size=2>error '80004005'</font>
    <p>
    <font face="Arial" size=2>Unspecified error</font>
    <p>
    <font face="Arial" size=2>/ASPSamp/oracbir/sujal/imgtrialora.asp</font><font face="Arial" size=2>, line 38</font>
    NB:- Line 38 is where the query is executed. i.e set rsBlob = cn.Execute(SQLQuery)
    Could you tell me what I did wrong? I am using Oracle 8.1.6 on Win NT..
    Does field of type ORDSYS.ORDVIR have extra info stored along with the image which needs to be removed before displaying the image..
    null

    Since ODBC does not understand Oracle object types, you must select the BLOB locater, not the VIR Object.
    One you've done that you need to loop over the data in the BLOB, pushing it out the Binary response object.
    You may also want to select the mimetype from the VIR object and use that value to set the content type of the response object.
    Here's a piece of code that does the job:
    strSQL = "SELECT t.IMAGE_THUMB.getMimetype(), t.IMAGE_THUMB.getContentLength(), t.IMAGE_THUMB.getContent() FROM IMPB.IMAGE_ITEMS t WHERE IMAGE_ID = 1"
    set rsOrdMediaSource = Server.CreateObject("ADODB.Recordset")
    rsOrdMediaSource.ActiveConnection = "dsn=impb_imperf;uid=impb;pwd=impb;"
    rsOrdMediaSource.Source = strSQL
    rsOrdMediaSource.CursorType = 0
    rsOrdMediaSource.CursorLocation = 2
    rsOrdMediaSource.LockType = 1
    rsOrdMediaSource.MaxRecords = 1
    rsOrdMediaSource.Open()
    If rsOrdMediaSource.EOF Then
    Response.Status = "404 Not Found"
    Response.End
    End If
    Dim blob
    Dim bytesToGo
    bytesToGo = rsOrdMediaSource.Fields.Item(1).value
    Dim vBuffer
    set blob = rsOrdMediaSource.Fields.Item(2)
    If Response.Buffer Then Response.Clear
    Response.Buffer = false
    Response.ContentType=rsOrdMediaSource.Fields.Item(0).value
    While bytesToGo > 0
    vBuffer = blob.getChunk(CLng(32768))
    Response.BinaryWrite(vBuffer)
    bytesToGo = bytesToGo - 32768
    Wend
    Reponse.End
    null

  • Sending image from MS SQL SERVER to Oracle BLOB

    Hey all, we're trying update Oracle via a SQL Server linked server and we're having an issue with a blob column. The update from SQL is:
    UPDATE Banner..GENERAL.PS_EBI_IF_TBL
    set photo = a.blob_file, photo_change_date=a.blob_date
    from PWNT.dbo.BLOBS a, PWNT.dbo.BADGE_V b
    where a.ID = b.ID
    and base_name = b.BADGE_BASE_NAME
    and b.BADGE_blob_date > getdate()-.021
    GO
    The error we get is:
    OLE DB provider "OraOLEDB.Oracle" for linked server "Banner" returned message "ORA-01747: invalid user.table.column, table.column, or column specification".
    The syntax is correct, we can run it if the column being updated (photo) is not a blob, so we believe there is something else we have to do because of the blob. Has anybody done anything like this and know how it works? Thanks!
    Tom

    Given that there are no version numbers is your post I can imagine many possibilities for misconfiguration. Especially as an Oracle BLOB bears no direct size relationship to anything MS SQL could possibly support.

  • CMP Bean's  Field Mapping with oracle unicode Datatypes

    Hi,
    I have CMP which mapps to RDBMS table and table has some Unicode datatype such as NVARCHAR NCAR
    now i was woundering how OC4J/ oracle EJB container handles queries with Unicode datatypes.
    What i have to do in order to properly develope and deploy CMP bean which has fields mapped onto the data based UNICODE field.?
    Regards
    atif

    Based on the sun-cmp-mapping file descriptor
    <schema>Rol</schema>
    It is expected a file called Rol.schema is packaged with the ejb.jar. Did you perform capture-schema after you created your table?

  • 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

Maybe you are looking for