Serialize DOM between two ejb's performance

Hi,
I am working with XML in a ejb container and I used JDOM Document (org.jdom.Document) to send the xml document between two ejb's, I picked JDOM because the Document implements the Serilizable interface. Then I did some performance tests on sending JDOM between two ejb's. I also did tests on sending a String rep. of the XML between the same ejb's. The result supprised me very much.
Here is the testing code:
// init
dom.loadFromPath("C:\\booklist.xml");
String xml = dom.getXML();
org.jdom.Document doc = db.build(dom.queryDocument());
// ... ejb lookup etc...
// ejb test
long start2 = System.currentTimeMillis();
for ( int i = 0 ; i < 1000; i ++ )
test.jdomTest(doc); // jdom doccument
long end2 = System.currentTimeMillis();
// string test...
long start1 = System.currentTimeMillis();
for ( int i = 0 ; i < 1000; i ++ )
test.stringTest(xml); // String
long end1 = System.currentTimeMillis();
and the results:
JDOM: 41703 msek
String: 313 msek
Send String and load him into a DOM in the receiving ejb: 5266 msek.
I have always thought that working with xml on a string format would be to much overhead.
Could somebody clearify this for me? Does this test results make any sense?
- thanks, Lubbi Tik

The serialisation process works at the object level, so to serialise an object you must first serialise every attribute of that object. The specification for serialisation states that every object which wants to be serialisable must have attributes which are primative types (eg int, long etc etc) or attributes which are objects which are serialisable. So to serialise a JDOM you must serialise each of the child nodes in the document, it would be a lot of object manipulation in this example. To serialise a String however, is much easier as it is a much less complex type.
Cheers,
Peter.

Similar Messages

  • A point to point communication between two EJB

    How do we make a point to point communication between two ejb? Must i use mdb or session bean?
    Because i have a problem: how can i send a message to a specific EJB that i choose?
    Thanks

    Yes....U should post a message from EJB1 to a queue and listener can be the second EJB (Better if its an MDB).
    Whats the problem U r facing?
    -Rais

  • Share persistence.xml file between two EJB modules in EAR

    Hello, everybody!
    First of all, I would like to say that I already posted this question in another forum:
    [http://community.jboss.org/thread/154128?tstart=0]
    But as I haven't got any answer from there and this issue is very crucial to me I'm posting it here too in the hope that I get an answer. So, here it goes:
    I have two EJB modules in an EAR module. I would like to know how to share a single persistence.xml file with these two EJB modules. If I replicate the persistence.xml file in the two EJB modules, the EAR project deploys ok, but of course that's not what we want. If I remove the persistence.xml file from any of the EJB projects, the EAR doesn't deploy properly. I'm stuck with this. I've already tried many kind of configurations but none worked. I really would like to have some help with this issue to proceed working. This is my EAR structure:
    solicitacoes-ejb.jar       (EJB session beans)
    solicitacoes-dao.jar       (EJB interfaces)
    solicitacoes-dao-jpa.jar   (EJB session beans)
    solicitacoes-ejbClient.jar (entities and EJB interfaces)
    solicitacoes-web.war
    META-INF/This is my application.xml file:
    <?xml version="1.0" encoding="UTF-8"?>
    <application
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="http://java.sun.com/xml/ns/javaee"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_5.xsd"
    version="5">
        <display-name>solicitacoes-ear</display-name>
        <module>
            <ejb>solicitacoes-ejb.jar</ejb>
        </module>
        <module>
            <ejb>solicitacoes-dao-jpa.jar</ejb>
        </module>
        <module>
            <web>
                <web-uri>solicitacoes-web.war</web-uri>
                <context-root>solicitacoes</context-root>
            </web>
        </module>
    </application>If I remove the persistence.xml file from one of the EJB modules, let's say solicitacoes-dao-jpa.jar, I get this error when deploying the EAR file:
    ... 39 more
    Caused by: java.lang.IllegalArgumentException: Can't find a persistence unit named 'null' in AbstractVFSDeploymentContext@28359170{vfs:///C:/jboss-6.0.0.20100429-M3/server/default/deploy/solicitacoes-ear.ear/solicitacoes-dao-jpa.jar/}
    at org.jboss.jpa.resolvers.BasePersistenceUnitDependencyResolver.resolvePersistenceUnitSupplier(BasePersistenceUnitDependencyResolver.java:107) [:1.0.2-alpha-1]
    at org.jboss.ejb3.Ejb3Deployment.resolvePersistenceUnitSupplier(Ejb3Deployment.java:778) [:1.3.1]
    at org.jboss.ejb3.EJBContainer.resolvePersistenceUnitSupplier(EJBContainer.java:1517) [:1.3.1]
    at org.jboss.injection.PersistenceUnitHandler.addPUDependency(PersistenceUnitHandler.java:130) [:1.3.1]
    ... 43 moreI need help with this issue. As you could see, the EJB container doesn't like to see an EJB module without a persistence.xml file. This is clearly a dumb decision though. I agree with it if there was only one EJB module in an EAR. But the container should have been smart enough to require only one persistence.xml file in an EAR module with more than one EJB module, and share that persistece context with the whole EAR.
    Acting the way it is acting now, the container forces us to duplicate the persistece.xml file and kill our application modularity. This is clearly wrong. I've already tried to put the entity classes and persistence.xml file in the lib directory of the EAR, but it didn't work either. The container needs to have the persistence.xml file in both EJB modules.
    I don't know if this is a JBoss implementation decision or if it comes from the Java EE 6 specification. Whatever it is, it goes against all good modular and good design decision. Please if some of you know how to solve this, took a little time to tell me how. I would be very grateful.
    Thank you in advance.
    Marcos

    Dear Mr. gimbal2,
    In another occasion I would not reply to such a 'helpful' answer like the one you gave me (yes, it is undoubtedly an answer because that's how you classified it in the beginning of your reply), but as today I have plenty of time here in my job, for this week we're not working full time as usual, I decided to reply to it.
    You have to completely overhaul your attitude.I really didn't know I was taking so personal on this issue to have to 'completely overhaul my attitude'. Thank you for pointing that out.
    In stead of calling the technology dumb, admit to yourself that perhaps you don't understand it properly and that your ideas of what is correct design perhaps is a little lacking. I didn't call the technology dumb because I stated very clearly that I don't know for sure if it is working this way. I said in the last paragraph:
    +"I don't know if this is a JBoss implementation decision or if it comes from the Java EE 6 specification. Whatever it is, it goes against all good modular and good design decision."+
    So, I let implicit the fact that the technology or the implementation of the technology is dumb only if it doesn't allow this possibility. Regarding the fact that your said that I should
    admit to myself that perhaps I don't understand it properly, where did I stated in my question that I understand it completely? It's clear in the last paragraph that I don't. If I'm asking that's because I have doubts. Maybe my ideas of what is correct is wrong, and that's why I'm here in this forum. But everyone with a good sense knows that what I propose in this discussion is by no means a wrong design decision. Where is it a sin to have more than one EJB module in a EAR and a persisntece.xml file shared for the whole EAR? Does everyone that has more than one EJB module in an EAR module need to connect to more than one database? Is it wrong to want to have your DAO implementation in a separate EJB module in order to make deployment easy and also changes, if you later want to replace that implementation with another one without affecting
    the other modules? I don't think that a design decision that seeks this is lacking. I don't think that Java EE today is a dumb technoloby, but everyone knows that before it gets to the present level, it was a technology known to have made big dumb decisions that the community latter corrected, with ideas like O/R mapping (Hibernate), dependency injection (Spring), Struts and lots of other examples that we all know. No one can deny this and lots of wrong things will continue to be fixed in later releases.
    Maybe when you rise yourself back to that level, you open yourself up again to thinking in correct solutions in stead of trying to hammer through your own poorly chosen one.To be sincere, I see you took very personal about this issue. You really shows to be someone that has no respect to other people and you judge them too. I must say that I got surprised by the way you answered my post. I didn't expect to get such sarcastic answer to what I asked. I personally don't act this way. If I can't help a person, I also don't try to ridicularize him.
    Marcos

  • How can i use cmr between two EJB which are belong to different database?

     

    Perhaps, on the EJB's Entity tabs, in the Deployment settings dialog, you could make sure each bean references a different DB (Change the JNDI name, under Database settings).
    However, I don't know this for sure - you may have to use bean-managed persistence.

  • How to perform a WS-transaction between two webservices implemented in EJB3

    Hello,
    I would like to have an example of how to perform a WS-Transaction between two web services implemented with EJB 3.0. It should be done through code.
    Thanks in advance.

    Bit a late answer, btu I don't like googling for somthing and founding open questions about the topic I search for.
    Have a look at
    http://jbossws.jboss.org/mediawiki/index.php?title=JAX-WS_User_Guide
    and
    http://soa.sys-con.com/node/39769
    Cheers

  • Performance between two partitionned tables with different structure

    Hi,
    I would like if there is a difference between two partitionned tables with different structure in term of performance (access, query, insertions, updates ).
    I explain myself in detail :
    I have a table that stores one value every 10 minutes in a day (so we have 144 values (24*6) in the whole day), with the corresponding id.
    Here is the structure :
    | Table T1 |
    + id PK |
    + date PK |
    + sample1 |
    + sample2 |
    + ... |
    + sample144 |
    The table is partionned on the column date, with a partionned every months. The primary key is based on the columns (id, date).
    There is an additionnal index on the column (id) (is it useful ?).
    I would like to know if it is better to have a table with just (id, date, value) , so for one row in the first table we'll have 144 rows in the future? table. The partition will already be on the columns (id, date) with the index associated.
    What are the gains or loss in performance with this new structure ( access, DMLs , storage ) ?
    I discuss with the Java developers and they say it is simpler to manage in their code.
    Oracle version : Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
    Thanks & Regards
    From France
    Oliver
    Edited by: 998239 on 5 avr. 2013 01:59

    I mean storage in tablespaces and datafiles on disk.
    Can you justify please and give me concrete arguments why the two structures are equivalent ( except inserting data in T(id, date,value))
    because i have to make a report.i didnt say any thing like
    two structures are equivalent ( except inserting data in T(id, date,value)i said
    About structure : TABLE1(id, date, value) is better than TABLE1(id, date, sample1, .... sample144)because
    1) oracle has restriction for numbers of column. Ok you can have 144 columns now but for future if you must have more than 1000 columns , what will you do?
    2) Restrictions on Table Compression (Table compression is not supported for tables with more than 255 columns.)
    3) store same type values on diffrent columns is bad practise
    http://docs.oracle.com/cd/B28359_01/server.111/b28318/schema.htm#i4383
    i remember i seen Toms article about this but now i cant find it sorry ((( if i found i will post here

  • Problem mapping a 1:M relationship between two entity EJBs w/ a compound PK

    I am having trouble trying to implement a 1:M relationship in OC4J 9.0.3 between two EJB2.0 entity beans using an EJBQL query. I have an ApplicantEJB, which contains a collection of phone numbers. The applicant table in the database has one primary key, applicant_id. The applicant_phones database table has a compound primary key--applicant_id and phone_type_id--so I have implemented a custom PK class to represent this, PhonePK. I have implemented a findByNameAndPhone method in my ejb-jar.xml file with the following syntax:
    SELECT object(a) FROM applicants a, applicant_phones p where a.applicantID = p.applicantID and a.name = ?1 and p.phoneNumber = ?2
    If I deploy this, Orion/OC4J translates the query in the orion-ejb-jar.xml with an incorrect reference to the applicant_phones.applicant_id column:
    SELECT a.applicant_id FROM applicants a , applicant_phones p WHERE ((a.applicant_id = p.applicantID ) AND (a.name = ?) AND (p.phone_number = ? ))
    I must have something wrong with my ApplicantEJB and PhoneEJB primary key mappings in my orion-ejb-jar.xml file, but I have tried many different combinations of values and keep getting them overwritten by the container with each deployment. Why is Orion/OC4J defaulting the applicant_id reference Long postings are being truncated to ~1 kB at this time.

    Sure. Here's the <entity-deployment> for my applicant entity:
    <entity-deployment name="ApplicantEntityEJB" location="ApplicantEntityEJB" table="applicants" data-source="java:/OracleDS">
    <primkey-mapping>
    <cmp-field-mapping name="applicantID" persistence-name="applicant_id"/>
    </primkey-mapping>
    <cmp-field-mapping name="name" persistence-name="name"/>
    <cmp-field-mapping name="phones">
    <collection-mapping table="applicant_phones">
    <primkey-mapping>
    <cmp-field-mapping name="applicantID">
    <entity-ref home="ApplicantEntityEJB">
    <cmp-field-mapping name="applicantID" persistence-name="applicant_id"/>
    </entity-ref>
    </cmp-field-mapping>
    </primkey-mapping>
    <value-mapping type="test.entity.PhoneEntity">
    <cmp-field-mapping>
    <entity-ref home="PhoneEntityEJB">
    <cmp-field-mapping>
    <fields>
    <cmp-field-mapping name="phoneTypeID" persistence-name="phone_type_id"/>
    <cmp-field-mapping name="applicantID" persistence-name="app[i]Long postings are being truncated to ~1 kB at this time.

  • Using 1394 to perform communication between two PCs

    Hi all,
    Does anybody knows how to use a 1394 (firewire) to implement a communication between two computers using Labview ?
    Do I need a special toolkit for this ?
    Thanks
    Eduardo

    Currently, if you have installed NI-VISA, you should have the 1394 Passport already installed and running. This gives you the ability to communicate with 1394 instruments via your 1394 instruments. This is important because this helps determine how you will communicate from one computer to another. If you want to use the VISA and communicate using the FireWire INSTR, then you need to find or create drivers for your 1394 ports that allow you to communicate with them as 1394 instruments. There might be other ways to do this, but this is probably the most simple. Once you've got the pcs set up, you can just use VISA to communicate with your other devices.
    Logan S.

  • Managed bean/Data exchange between two ADF Rich Faces based applications

    Hi,
    I have been trying to research what seems to be a small issue. My requirements are as follows.
    1. I need to be able to pass managed bean information from one ADF Rich Faces based application to another (in two separate ears) at runtime (e.g. from Ear1: SenderApp/Sender.jspx -> Ear2: ReceiverApp/Receiver.jspx).
    2. I do not want to use the database as my applications need to be performant.
    3. Serialization/de-serialization would fall pretty much under the database category. In other words, I like to avoid Serialization/de-serialization of the managed bean.
    4. I cannot use query string due to security issues.
    My question is as follows:
    1. Is there any standard/architecture/best practices for data exchange of backing beans or other forms between two ADF Rich Faces based apps (in two separate ears)?
    2. Has someone found anything similar to an applicationScope that works across applications?
    I would appreciate any ideas.
    Thanks very much,
    Edited by: user11219846 on Jul 23, 2009 2:38 PM
    Edited by: user11219846 on Jul 23, 2009 2:42 PM

    Hi,
    its not an ADF Faces problem, but not possible in Java EE. You can however fallback to vendor specific implementations like in WLS. From the WebLogic documentation : http://e-docs.bea.com/wls/docs103/webapp/sessions.html
    Enabling Web applications to share the same session*
    By default, Web applications do not share the same session. If you would like Web applications to share the same session, you can configure the session descriptor at the application level in the weblogic-application.xml deployment descriptor. To enable Web applications to share the same session, set the sharing-enabled attribute in the session descriptor to true in the weblogic-application.xml deployment descriptor. See “sharing-enabled” in session-descriptor.
    The session descriptor configuration that you specify at the application level overrides any session descriptor configuration that you specify at the Web application level for all of the Web applications in the application. If you set the sharing-enabled attribute to true at the Web application level, it will be ignored.
    All Web applications in an application are automatically started using the same session instance if you specify the session descriptor in the weblogic-application.xml deployment descriptor and set the sharing-enabled attribute to true as in the following example:
    +<?xml version="1.0" encoding="ISO-8859-1"?>+
    +<weblogic-application xmlns="http://www.bea.com/ns/weblogic/90";;>+
    +...+
    <session-descriptor>     
    +<persistent-store-type>memory</persistent-store-type>+
    +<sharing-enabled>true</sharing-enabled>+
    +...+
    +</session-descriptor>+
    +...+
    +</weblogic-application>+
    Frank

  • JMS transaction between two queues

    Hi there,
              I have been asked to build some code that will act as an adapter
              between two legacy systems. Basically I will have to read from a
              queue, transform the information and write it to the other, then
              receive the response, transform it, and put it again back to the
              "caller" system.
              There are 4 queues implicated in this task.
              I will to use JMS Api in my code but I have found a problem. The way
              of performing a transaction in JMS is this:
              QueueSession queueSession = queueConnection.createQueueSession(true,
              0);
              "Here, the first argument means that the session is transacted; the
              second indicates that message acknowledgment is not specified for
              transacted sessions."
              As queueConnection is a connection to ONE queue, I can only perform
              transactions to ONE queue! But I don´t want to consume a message till
              I know it has been sent correctly to the other side.
              I have also read that some JMS providers support JTA transactions.
              But I don´t know if this is the right way to go.
              Can anybody bring some light to this issue.
              Thaks al lot for your attention!!
              

              This post has blossomed into several threads. I'm going to
              attempt a shot-gun approach to answer all questions.
              On MQSeries:
              See "How to use IBM MQ as a JMS Provider?" posts for more info.
              On transacted sessions:
              If this is ALL MQSeries, then it is up to MQSeries if a transacted
              session can span multiple queues and/or servers. WL supports this.
              MQSeries may simply prevent a session from
              spanning multiple servers and/or queues. Note that other vendors,
              that do not have their own TX monitor, very very likely do
              not have a 2PC in a transacted session that spans multiple servers
              (meaning it is not truly transactional).
              On JTA and multiple queues:
              The whole reason for being for JTA is to be able to span multiple
              operations. Yes, this is supported in WL.
              On the manuals:
              These issues are covered in great detail in the WL JMS developer's
              guide in the transactions chapter.
              On bridging:
              You do not have to write your own bridge.
              WL supplies a bridge to greatly simplify the work involved.
              WL 7.0 can even bridge two XA compliant JMS implementations transactionally.
              (Neither has to be WL JMS.) WL 6.1SP3 will have this same feature, now
              avialable as alpha code in 6.1. See "How to use IBM MQ as a JMS Provider?" posts for more
              info.
              On queuing and transactions:
              One can not include a request and its response in the same transaction. Period.
              This is the nature of queueing. One can dequeue from one queue and
              enqueue to another. I think you understand this, but it bears repeating.
              Tom
              Mac wrote:
              > I know that a recieve will not remove a message and a send will not
              > send it until the transaction is commited.
              >
              > In fact I want to do 2 transactions one for each receive-send.
              >
              > graphic again! ;)
              >
              > queue1 queue3
              > ======> =====>
              > legacy 1 Java Adapter legacy 2
              > queue2 queue4
              > <====== <=====
              >
              > In the period of time between reading from queue1 and writing to
              > queue3 the adapter could fail thus a message will be lost. The same
              > happens with queue4 and 2. Maybe this could be solved with a
              > transaction over queue1 and another one over queue4, but I'm not sure.
              >
              > I will have to decide if I use JMS or MQSeries API. MQ allows you to
              > wrap more than one queue in the same transaction if they are in the
              > same Queue Manager. So I wanted to know if JMS also allows to make a
              > transation over more than one queue and how is it done. only JTA?
              > QueueSession? impossible?
              >
              > tnx really for your help!
              >
              > "Raja Mukherjee" <[email protected]> wrote in message news:<[email protected]>...
              > > You can not. Even if you could, it's at least have to be 2 transactions.
              > > Because, if all of your work is in one transaction you will never send or
              > > receive messages, you would be blocking for ever. In order to send the
              > > message you will have to commit the transaction on the first place.
              > >
              > > .raja
              > >
              > > "Mac" <[email protected]> wrote in message
              > > news:[email protected]...
              > > > Sorry Tom, I think that I have not explained well my problem.
              > > >
              > > > The following extrange symbols are supposed to be an explaining
              > > > graphic!! ;)
              > > >
              > > >
              > > > queue1 queue3
              > > > ======> =====>
              > > > legacy 1 Java Adapter legacy 2
              > > > queue2 queue4
              > > > <====== <=====
              > > >
              > > > Legacy System 1 wants to call a service of legacy system 2, but they
              > > > can not communicate directly so we will use MQ Series as both them
              > > > support it.
              > > > For that purpose Legacy1 puts a message in queue1. The Java Adapter
              > > > transforms the message and puts it in queue3. Legacy2 processes the
              > > > request and replies with a message in queue4. The Java Adapter gets
              > > > it, transforms it and puts it in queue2. As a result legacy1 obtains
              > > > the information it was asking for.
              > > >
              > > > I'm using MQ Series 5.2 as middleware. I will not use Message Driven
              > > > Beans so I won´t have an EJB container to perform distributed
              > > > transactions.
              > > >
              > > > The question is: How can I put and get messages in the 4 queues
              > > > using de same transaction?? Can I do it somehow with JMS session or I
              > > > must use a JTA transaction?
              > > >
              > > > Thanks again for your help, and forgive me for being so insistent!
              > > > :)
              [att1.html]
              

  • Change or delete the docflow link between two existing documents

    Hi All,
    Is there any FM or soulution to change the doc flow link between two documents .
    For ex .. i have document A and document B , and created a doc flow link from A to B , Now i have to change the succeeding document  to C
    I have tried to modify the doc link ,but its not working using crm_order_maintain.I thought of deleting the link between A and B and then create a new link Between A and C , but deletion of link bewteen A and B is also not working.
    I have checked with FMs CRM_DOC_FLOW_DELETE_CHECK_EC and CRM_DOC_FLOW_DELETE_EC, followed by CRM_ORDER_SAVE AND COMMIT . i could not find any exception from this FMs , but still the doc link is not deleted.
    Pls share if you have any suggestions.
    Regards,
    Nithish

    Hello
    I wrote a report to delink items from document flow. I uploaded it [here|http://wiki.sdn.sap.com/wiki/display/CRM/Removelinksfromdocumentflow].
    Please, use with caution and always perform careful tests before you run it in a production envinronment.
    Hope it helps
    Joaquin
    Edited by: Joaquin Fornas on Nov 15, 2011 11:49 AM

  • Unable to find line break between two lines in attachment file.

    Dear all I will be very great full if someone help me out,
    I am trying to send mail through SMTP server with an attachment of oracle report, but I am unable to find line break between two lines, when I down load the attachment from mail and open attach.txt file by double click on it. Next line starts right after previous line ends, it should starts with new line.
    In order to send an attachment file, I am reading source file line by line and put MIME protocol’s attachment instance, contain of source file is being properly written into target file if I open that attachment on cmd prompt.
    Following code may help you to understand the case.
    Thanks in advance.
    My code is as follows:-
    create or replace procedure bec_file_test
    v_subject varchar2, -- Subject of the email
    v_body varchar2, -- Body of the email
    v_from VARCHAR2 default 'XYZ.com', -- sender mail id
    v_to varchar2 default 'XYZ.com', -- Field To of the email
    v_cc varchar2 default 'XYZ.com' -- cc address
    ) is
    -- variable to hold the smtp server connection
    v_smtp_connection utl_smtp.connection;
    -- variable to hold the smtp host name
    v_smtp_host varchar2(100) default 'mail.bec-group.com';
    -- variable to hold the smtp port
    v_smtp_port number default 25;
    -- composite of {CR}{LF} caridge return and line feed.
    CRLF varchar2(2):=CHR(13)||CHR(10);
    cursor pr_rec is
    select requisition_no,line_no,release_no,a.contract,
    a.project_id,substr(a.activity_seq,1,11)ACT_SEQ,
    substr(a.part_no,1,12)PART_NO,
    substr(a.description,1,32)DESCRIPTION,
    substr(a.Bal_qty,1,8) BAL_QTY,
    substr(a.unit_meas,1,5)UOM,
    a.wanted_receipt_date WAN_REC_DT,
    a.latest_order_date LAT_ORD_DT
    from bec_pr_line_rep a
    where a.Bal_qty>0 and a.header_state not in 'Closed'
    and upper(a.state1) like 'RELEASED' and a.contract not in ('U1ENG','ULENG','U1FND','U2FND')
    and a.buyer_code='70306'
    order by a.part_no;
    begin
    declare
    fHandle UTL_FILE.FILE_TYPE;
    v_msg_line varchar2(2000);
    -- v_buffer varchar2(20000);
    --ALTER SYSTEM SET utl_file_dir = 'D:\Database\temp'
    --COMMENT='Temporary change on Dec 14'
    --SCOPE=SPFILE;
    SELECT name, value
    FROM gv$parameter
    WHERE name = 'utl_file_dir';
    --drop directory my_directory
    --CREATE or replace DIRECTORY my_directory AS 'D:\database\temp';
    --GRANT read,write ON DIRECTORY my_directory TO PUBLIC;
    begin ---writing data into a file.
    fHandle := UTL_FILE.FOPEN('MY_DIRECTORY', 'pending_pr_summry.txt', 'w');
    UTL_FILE.put_line(fHandle, ' Pending PR to process (detail report)');
    UTL_FILE.put_line(fHandle,TO_CHAR(SYSDATE,'MM-DD-YY HH:MI:SS AM'));
    UTL_FILE.put_line(fHandle, '--------------------------------------------------------------------------------------------------------------------------------------------------');
    UTL_FILE.put_line(fHandle, 'Req.no. li Re Site Prj Id Act seq Part no Description Qty UOM want rec dt lat ord dt' );
    UTL_FILE.put_line(fHandle, '--------------------------------------------------------------------------------------------------------------------------------------------------');
    for pr_temp in pr_rec loop
    begin
    v_msg_line:=to_char(rpad(pr_temp.requisition_no,12,' ')||'|'||
    lpad(pr_temp.line_no,3,' ')||'|'||
    lpad(pr_temp.release_no,3,' ')||'|'||
    rpad(pr_temp.contract,7,' ')||'|'||
    lpad(nvl(pr_temp.project_id,' '),7,' ')||'|'||
    lpad(nvl(pr_temp.act_seq,' '),12,' ')||'|'||
    lpad(pr_temp.part_no,12,' ')||'|'||
    rpad(pr_temp.description,35,' ')||'|'||
    lpad(pr_temp.bal_qty,10,' ')||'|'||
    rpad(pr_temp.uom,6,' ')||'|'||
    lpad(pr_temp.wan_rec_dt,14,' ')||'|'||
    lpad(pr_temp.lat_ord_dt,14,' '));
    UTL_FILE.put_line(fHandle,v_msg_line);
    end;
    end loop;
    UTL_FILE.put_line(fHandle, '--------------------------------------------------------------------------------------------------------------------------------------------------');
    UTL_FILE.put_line(fHandle, ' Regards : IFSAPP ( Application owner ) ');
    UTL_FILE.FCLOSE(fHandle); ------------writing into file is successfuly done here!
    --Reading of file starts here containt will be added in attchment file
    fHandle :=UTL_FILE.FOPEN('MY_DIRECTORY','pending_pr_summry.txt','R' );
    -- establish the connection to the smtp server
    v_smtp_connection := utl_smtp.open_connection(v_smtp_host, v_smtp_port); /** OPEN CONNECTION ON THE SERVER **/
    -- perform a handshake with the smtp server
    utl_smtp.helo(v_smtp_connection, v_smtp_host); /** DO THE INITIAL HAND SHAKE **/
    -- set the 'from' address of the message
    utl_smtp.mail(v_smtp_connection, v_from);
    -- add the recipient to the message
    utl_smtp.rcpt(v_smtp_connection, v_to);
    -- send the email
    utl_smtp.open_data(v_smtp_connection);
    v_msg_line:='Date: ' || TO_CHAR( SYSDATE, 'dd Mon yy hh24:mi:ss' ) || CRLF ||
    'From: ' || v_from || CRLF ||
    'Subject: ' || v_subject || CRLF ||
    'To: ' || v_to || CRLF ||
    'Cc: ' || v_cc || CRLF ||
    'MIME-Version: 1.0'|| CRLF || -- Use MIME mail standard
    'Content-Type: multipart/mixed;'||CRLF ||
    ' boundary="-----SECBOUND"'||CRLF||
    CRLF ||'-------SECBOUND'|| CRLF ||
    'Content-Type: text/plain;'|| CRLF ||
    'Content-Transfer_Encoding: 7bit'|| CRLF ||
    CRLF ||v_body|| CRLF;     -- Message body
    utl_smtp.write_data(v_smtp_connection,v_msg_line);
    v_msg_line:='-------SECBOUND'|| CRLF ||
    'Content-Type: application/octet-stream;'|| CRLF ||
    'Content-Type: text/plain;'|| CRLF ||
    'name="pending_pr_summry.txt"'|| CRLF ||
    'Content-Transfer_Encoding: 8bit'|| CRLF ||
    'Content-Disposition: attachment;'|| CRLF ||
    ' filename="pending_pr_summry.txt"'|| CRLF || CRLF;     -- Content of attachment
    utl_smtp.write_data(v_smtp_connection,v_msg_line);
    -- check file is opened
    IF utl_file.is_open(fHandle) THEN
    -- loop lines in the file
    LOOP
    BEGIN -- Content of attachment
    utl_file.get_line(fHandle,v_msg_line);
    v_msg_line:=concat(v_msg_line,CRLF);
    utl_smtp.write_data(v_smtp_connection,v_msg_line);
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    EXIT;
    END;
    END LOOP;
    END IF;
    --end of attachment containt     
    utl_smtp.write_data(v_smtp_connection,v_msg_line);
    UTL_FILE.FCLOSE(fHandle);
    utl_smtp.close_data(v_smtp_connection);
    utl_smtp.quit(v_smtp_connection);
    exception
    when utl_smtp.invalid_operation then
    dbms_output.put_line(' Invalid Operation in Mail attempt using UTL_SMTP.');
    when utl_smtp.transient_error then
    dbms_output.put_line(' Temporary e-mail issue - try again');
    when utl_smtp.permanent_error then
    dbms_output.put_line(' Permanent Error Encountered.');
    when others then
    dbms_output.put_line('Exception: SQLCODE=' || SQLCODE || ' SQLERRM=' || SQLERRM);
    RAISE;
    end;
    end bec_file_test;

    Pending PR to process (detail report)01-17-13 12:43:19 PM--------------------------------------------------------------------------------------------------------------------------------------------------Req.no. li Re Site Prj Id Act seq Part no Description Qty UOM want rec dt lat ord dt--------------------------------------------------------------------------------------------------------------------------------------------------MAT/250370 | 2| 1|ISCSP | 4977| 100004207| 0104000016|Angle 50 X 50 X 6 IS:2062 Grade |500|kg |30-NOV-2012| 20-nov-2012MAT/250370 | 3| 1|ISCSP | 4977| 100004207| 0105000002|Channel 100 X 50 IS:2062 Grade A | 1000|kg | 30-NOV-2012| 20-nov-2012MAT/250579 | 2| 1|NMDCJ | 6001| 100005580| 0109020002|TMT Bar 10 mm Fe 415 IS:1786 | 2991|kg | 13-DEC-2012| 03-dec-2012MAT/250606 | 2| |NMDCJ | 6002| 100005860| 0109020002|TMT Bar 10 mm Fe 415 IS:1786 | 4500|kg | 29-DEC-2012| 19-dec-2012MAT/250607 | |1|NMDCJ|6001|100005580| 0109020002|TMT Bar 10 mm Fe 415 IS:1786 | 1500|kg | 29-DEC-2012| 19-dec-2012MAT/250194 | 3| 1|NMDCJ | 6002| 100005818| 0109020002|TMT Bar 10 mm Fe 415 IS:1786 | 3939|kg | 29-DEC-2012| 19-dec-2012MAT/250606 | 4| 1|NMDCJ | 6002| 100005860| 0109020004|TMT Bar 16 mm Fe 415 IS:1786 | 39000|kg | 29-DEC-2012| 19-dec-2012MAT/250607 | 4| 1|NMDCJ | 6001| 100005580| 0109020004|TMT Bar 16 mm Fe 415 IS:1786 | 17500|kg | 29-DEC-2012| 19-dec-2012MAT/250194 | 2| 1|NMDCJ | 6002| 100005818| 0109020004|TMT Bar 16 mm Fe 415 IS:1786 | 12183|kg | 29-DEC-2012| 19-dec-2012MAT/250606 | 6| 1|NMDCJ | 6002| 100005860| 0109020006|TMT Bar 25 mm Fe 415 IS:1786 | 9500|kg | 29-DEC-2012| 19-dec-2012MAT/250607 | 6| 1|NMDCJ | 6001| 100005580| 0109020006|TMT Bar 25 mm Fe 415 IS:1786 | 4500|kg | 29-DEC-2012| 19-dec-2012MAT/250194 | 6| 1|NMDCJ | 6002| 100005818| 0109020006|TMT Bar 25 mm Fe 415 IS:1786 | 17500|kg | 29-DEC-2012| 19-dec-2012MAT/250607 | 7| 1|NMDCJ | 6001| 100005580| 0109020008|TMT Bar 32 mm Fe 415 IS:1786 | 22000|kg | 29-DEC-2012| 19-dec-2012MAT/250194 | 7| 1|NMDCJ | 6002| 100005818| 0109020008|TMT Bar 32 mm Fe 415 IS:1786 | 27060|kg | 29-DEC-2012| 19-dec-2012MAT/251138 | 1| 1|NMDCJ | 6002| 100005825| 3501000001|Cement 50 kg | 1|pkt | 25-DEC-2013| 14-dec-2013--------------------------------------------------------------------------------------------------------------------------------------------------
    where as source file is like that:-
    Pending PR to process (detail report)
    01-17-13 12:43:19 PM
    Req.no. li Re Site Prj Id Act seq Part no Description Qty UOM want rec dt lat ord dt
    MAT/250370 | 2| 1|ISCSP | 4977| 100004207| 0104000016|Angle 50 X 50 X 6 IS:2062 Grade | 5500|kg | 30-NOV-2012| 20-nov-2012
    MAT/250370 | 3| 1|ISCSP | 4977| 100004207| 0105000002|Channel 100 X 50 IS:2062 Grade A | 1000|kg | 30-NOV-2012| 20-nov-2012
    MAT/250579 | 2| 1|NMDCJ | 6001| 100005580| 0109020002|TMT Bar 10 mm Fe 415 IS:1786 | 2991|kg | 13-DEC-2012| 03-dec-2012
    MAT/250606 | 2| 1|NMDCJ | 6002| 100005860| 0109020002|TMT Bar 10 mm Fe 415 IS:1786 | 4500|kg | 29-DEC-2012| 19-dec-2012
    MAT/250607 | 2| 1|NMDCJ | 6001| 100005580| 0109020002|TMT Bar 10 mm Fe 415 IS:1786 | 1500|kg | 29-DEC-2012| 19-dec-2012
    MAT/250194 | 3| 1|NMDCJ | 6002| 100005818| 0109020002|TMT Bar 10 mm Fe 415 IS:1786 | 3939|kg | 29-DEC-2012| 19-dec-2012
    MAT/250606 | 4| 1|NMDCJ | 6002| 100005860| 0109020004|TMT Bar 16 mm Fe 415 IS:1786 | 39000|kg | 29-DEC-2012| 19-dec-2012
    MAT/250607 | 4| 1|NMDCJ | 6001| 100005580| 0109020004|TMT Bar 16 mm Fe 415 IS:1786 | 17500|kg | 29-DEC-2012| 19-dec-2012
    MAT/250194 | 2| 1|NMDCJ | 6002| 100005818| 0109020004|TMT Bar 16 mm Fe 415 IS:1786 | 12183|kg | 29-DEC-2012| 19-dec-2012
    MAT/250606 | 6| 1|NMDCJ | 6002| 100005860| 0109020006|TMT Bar 25 mm Fe 415 IS:1786 | 9500|kg | 29-DEC-2012| 19-dec-2012
    MAT/250607 | 6| 1|NMDCJ | 6001| 100005580| 0109020006|TMT Bar 25 mm Fe 415 IS:1786 | 4500|kg | 29-DEC-2012| 19-dec-2012
    MAT/250194 | 6| 1|NMDCJ | 6002| 100005818| 0109020006|TMT Bar 25 mm Fe 415 IS:1786 | 17500|kg | 29-DEC-2012| 19-dec-2012
    MAT/250607 | 7| 1|NMDCJ | 6001| 100005580| 0109020008|TMT Bar 32 mm Fe 415 IS:1786 | 22000|kg | 29-DEC-2012| 19-dec-2012
    MAT/250194 | 7| 1|NMDCJ | 6002| 100005818| 0109020008|TMT Bar 32 mm Fe 415 IS:1786 | 27060|kg | 29-DEC-2012| 19-dec-2012
    MAT/251138 | 1| 1|NMDCJ | 6002| 100005825| 3501000001|Cement 50 kg | 1 |pkt | 25-DEC-2013| 14-dec-2013
    Ignore alignment. It is well formatted in source file.

  • How do I set Time Machine to alternate between two attached external drives (so that if one fails I will have a separate backup to use)?

    Hi Everyone.
    Thanks in advance for your help.
    Right off the bat let me say I am using Mavericks 10.9.1 on a 2011 Macbook Pro and using all Lacie external hard drives.
    I am trying to get Time Machine to alternate between two attached external hard drives, trying to be safe in case one of the backup drives itself fails.
    I have both drives set in Time Machine.
    From what I gather Time Machine should by default alternate between drives when backing up (I would assume it does one big initial backup on each then subsequent backups are just changes).
    But this is not how it seems to be working and I cannot find a straight answer despite much Googling and Foruming
    Unfortunately it seems to only be backing up to "External Hard Drive 1".
    There have been 4 backups since I set it up, all on "External Hard Drive 1", even though "External Hard Drive 2" is also attached and set in Time Machine.
    I manually clicked "Back Up Now" and it started to work on "External Hard Drive 2" (like I want it to) for a minute but it appears to have stopped and gone back to backing up to "External Hard Drive 1".
    Am I missing something? Does Time Machine only move on to another disk when the first one runs out of space? Do I have to turn one off in order to force it to back up to the other drive (that would be less convenient of course)?
    I am hoping that I am missing something and that it will just alternate between the two. Otherwise it is not the most comforting and thorough backup system as I had hoped when I purchased the additional external hard drive.
    I have a 1TB drive and a 500gig partition on another drive, both dedicated to backups (my Macbook HD is 475gig). It will take awhile for each to fill up and who knows what could happen during that time. Having Time Machine alternate between hard drives would be a nice small bit of security if the worst happened.
    I realize that there are tons of other options for backing up but I just want to use Time Machine if I can.
    Again thank you for your help!

    You cannot use Time Machine in that way. I'm not sure where you heard that Time Machine alternates between drives automatically. What you can do is create a mirrored RAID array for the backup. This automatically duplicates whatever is on one drive onto the other drive.
    Both drives must be the same size, and prefereably, exactly the same make and model. RAIDs can be configured using OS X's Disk Utility.
    RAID Basics
    For basic definitions and discussion of what a RAID is and the different types of RAIDs see RAIDs.  Additional discussions plus advantages and disadvantages of RAIDs and different RAID arrays see:
    RAID Tutorial;
    RAID Array and Server:
    Hardware and Service Comparison.
    Hardware or Software RAID?
    RAID Hardware Vs RAID Software - What is your best option?
    RAID is a method of combining multiple disk drives into a single entity in order to improve the overall performance and reliability of your system. The different options for combining the disks are referred to as RAID levels. There are several different levels of RAID available depending on the needs of your system. One of the options available to you is whether you should use a Hardware RAID solution or a Software RAID solution.
    RAID Hardware is always a disk controller to which you can cable up the disk drives. RAID Software is a set of kernel modules coupled together with management utilities that implement RAID in Software and require no additional hardware.
    Pros and cons
    Software RAID is more flexible than Hardware RAID. Software RAID is also considerably less expensive. On the other hand, a Software RAID system requires more CPU cycles and power to run well than a comparable Hardware RAID System. Also, because Software RAID operates on a partition by partition basis where a number of individual disk partitions are grouped together as opposed to Hardware RAID systems which generally group together entire disk drives, Software RAID tends be slightly more complicated to run. This is because it has more available configurations and options. An added benefit to the slightly more expensive Hardware RAID solution is that many Hardware RAID systems incorporate features that are specialized for optimizing the performance of your system.
    For more detailed information on the differences between Software RAID and Hardware RAID you may want to read: Hardware RAID vs. Software RAID: Which Implementation is Best for my Application?

  • Communication between Two WebLogic instances on the same machine

    Hi,
    We're having a problem with communication between two copies of Weblogic on
    the same machine. They are configured with seperate ports (regular and SSL).
    Independantly, they run fine. I can access EJBs running on either of them.
    The problem is that a bean in one of them has code which attempts to access
    an EJB on the other one. The procude fails when trying to obtain the initial
    context. This same code works if compilied independantly of WebLogic on the
    same machine.
    Are there any known issues regards communication between two running
    instances of Weblogic on the same machine?
    Thanks in advance,
    Randy Yarger
    marchFIRST
    [email protected]

    Thanks for the prompt reply.
    There is one IP address (internal address 10.227.1.34) one the machine. WLS1
    is set up at ports 7001 and 5133. WLS2 is setup at ports 7004 and 7005.
    When WLS1 attempts to obtain a context to WLS2 with the URL
    t3://10.227.1.34:7004/ it pauses for a long period of time. Running truss
    on the both WLS processes shows communication occuring between the two
    followed by long periods of silence. Finally WLS2 spits out the error
    ConnectionException[7001,7001,5133,5133,7001,7001] (paraphrased, I can get
    the entire error if it would help).
    After another long pause, WLS1 quits trying with the error 'Server
    10.227.1.34:7004 not found' (again paraphrased).
    Among the things we've tried:
    * Changing the URL from the IP to 127.0.0.1
    * Enabling/disabling SSL on either or both WLSs.
    * Changing the server name in WLS2's copy of weblogic.properties from
    'myserver' to 'myserver2' (previously they were both 'myserver')
    * Upgrading WLS2 to 5.1.0sp5 (Tried upgrading WLS1, but was getting class
    not found errors and quit because that WLS is being used by other people)
    This is a Solaris server. WLS1 is running 5.1.0 and WLS2 is running 5.1.0sp5
    Any suggestions would be appreciated.
    Best,
    Randy Yarger
    marchFIRST
    [email protected]
    "Michael Girdley" <[email protected]> wrote in message
    news:[email protected]...
    >
    >
    There should not be. What is your network configuration? Are they on
    separate IP addresses?
    Thanks,
    Michael
    Michael Girdley
    BEA Systems Inc
    "Randy Jay Yarger" <[email protected]> wrote in message
    news:[email protected]...
    Hi,
    We're having a problem with communication between two copies of Weblogicon
    the same machine. They are configured with seperate ports (regular andSSL).
    Independantly, they run fine. I can access EJBs running on either of
    them.
    The problem is that a bean in one of them has code which attempts toaccess
    an EJB on the other one. The procude fails when trying to obtain theinitial
    context. This same code works if compilied independantly of WebLogic onthe
    same machine.
    Are there any known issues regards communication between two running
    instances of Weblogic on the same machine?
    Thanks in advance,
    Randy Yarger
    marchFIRST
    [email protected]

  • Automatic creation of transportation lane between two Plants or location

    Hi,
    I am aware that when we cif Inforecords from R/3 to APO new transportation lanes automatically gets created between the Plant and Vendor.
    The isssue which i am facing is that i want transportation lanes to be created between two plants . The TL should be created automatically. I could find the below details from sap help.
    http://help.sap.com/saphelp_scm41/helpdata/EN/3e/dfaf376ed96c21e10000009b38f8cf/frameset.htm
    Transportation Lanes with Reference to R/3 Material Master Record
    Storing a special procurement type with procurement type F: External Procurement and special procurement U: Stock Transfer (in the MRP 2 view of the R/3 material master record), means that the material has to be procured externally from another plant (supplying plant) or transferred from another plant.
    To also be able to perform stock transfers for this material in the SAP APO system, there has to be a transportation lane from the supplying plant to the receiving plant. If you have transferred a material with this special procurement type from the SAP R/3 system, the SAP APO system automatically creates a corresponding transportation lane from the supplying plant to the receiving plant for the supplying plant (from the special procurement type) and material/plant combination. The transportation lane is given the creation indicator u201CSu201D for special procurement.
    I am not able to make sense of special procurement U: Stock Transfer (in the MRP 2 view of the R/3 material master record),
    Is this Special procurement some sort of customization as i could not find U: Stock Transfer  in my implementation.
    Please help me understand this. What exactly should i do to create TL between Plants automaticcaly through Cif.

    You need to define setting in IMG for this from source to Target location.
    Follow this path :
    Production->Material Requirements ->Master Data->Define Special Procurement Type
    example :
    Plant      1004
    SP type    40   Stock transfer (proc.from alter.plant)
    Procurement type     F    External procurement
    Special procurement  U    Stock transfer
    Plant                1039
    Manish

Maybe you are looking for

  • Jbo-26066 Error during rollback error

    Hi All, I ve developed an application which runs fine 95% of the time..but few times it throws this exception. Im unable to find out the possible reason behind this. The exception does not point to any of my code. Pls help me on this.. Thanks, Sreera

  • How to find the patchset and applied patches

    Hi all, I'd like to know is there some sql statement to show me the current patchset and the patches which are already applied to oracle. If no, please tell me how to check this. Thank you in advance

  • Changing document date and posting date by SE16N

    Hi All, an user has posted some customer documents (with tax codes) with wrong document date and posting date. I have to modify these data by se16n. In which tables I have to fill in? Thanks Gandalf

  • My camera, settings application and I.E application don't work on windows 8.1 after update

     After the last update on windows 8.1 Metro Apps don't start. I click on them, there is some animation showing the live tile expanding, then the app closes. This happens with every Metro App. how can I fix that? I tried everything and it's in vain!

  • I cannot open firefox for a week now. Causes/fix?

    Comcast came out last week to fix problems with their service in my area. They also replaced a splitter inside the house. Since then, I have been unable to open firefox (it won't connect), and I've had to use internet explorer. Never had this problem