Using RandomAccessFile with 9iAS

I have a question about reading (and writing) ASCII files with fixed-length records in an application that will run under OC4J. (FWIW, the application uses no EJBs.)
Since the J2EE spec forbids standard file i/o, it would seem that using RandomAccessFile is not an option.
Purchasing a JDBC driver for text files is not an option for our project, either.
Does 9iAS provide any other options, besides ignoring the J2EE spec?
TIA,
Al Margheim

Al -- I think it's only the EJB spec which forbids the use of IO and threading operations. As I understand it, from a servlet you should be OK to write to the filesystem. Of course, you'll need to do the work to make sure your app is threadsafe and IO safe (ie two concurrent requests can't try and write to the same file).
cheers
-steve-

Similar Messages

  • Using OID with 9ias Portal

    Has anyone deployed OID as the login service for ias applications or portal? Would appreciate any comments as we're considering it, not sure of the logistics in setting it up.

    Hello:
    I have Portal and Login Server running with OID. Make sure that 9iAS is in a seperate home to the 8.1.7 database. I would recomend installing OID and 8.1.7 in one instance and 9iAS in a seperate instance. If you install 9iAS in the same instance as your database you will have install failures.

  • How to append to next line using RandomAccessFile writeBytes

    Hi,
    How do you append to the next line using RandomAccessFile with writeBytes()
         static public void append(String strfilename, String strRecord)
              RandomAccessFile file;
              try
                   file = new RandomAccessFile(new File(strfilename), "rw");
                   file.seek(file.length());
                   file.writeBytes(strRecord);
                   file.close();
              catch(Exception e)
                   System.exit(1);
    Thanks,
    John

    At this point there is no next line or return key in SMS or BBM, a lot of people have asked for it. It exists on all the other apps for writing, but not on SMS and BBM.  Hopefully BB releases this simple fix for the messaging..

  • How to use 902 DB with 9iAS R2

    I am wondering if it is possibleto use the use 9.0.2. DB with 9iAS R2. I have a single machine and do not want 2 seperate database servers.
    Appreciate any info.
    Thanks!
    Bill G...

    Max,
    The database release 2 is numbered 9.2
    The application server is numbered 9.0.2 (the 9.0 in 9.0.2 represents the version of the db used in the infrastructure).
    For certification, please see: http://otn.oracle.com/software/products/ias/files/20_certification.html
    Thanks,
    Ashesh Parekh
    Oracle9iAS Product Management

  • Setup cocoon with 9ias 9.0.2 under windows NT

    Setup Cocoon with 9ias OC4J (9.0.2) under Windows NT
    This was a painful process for me. I finally made it work. Thought my story might help someone else. If anyone sees anything that could cause problems down the line, please let me know.
    NOTE: This took me a week to get right, so the restarts I suggest may not be appropriate, just guesses on my part.
    A. FIRST SECTION (Based off of steps 9 - 11 of Metalink note 148497.1) - This deploys the cocoon.war file
    1. Copy cocoon.war file to oracle 9ias home in the j2ee/home/applications directory. (NOT cocoon_jvm14. I tried to use the cocoon with jvm1.4. The version of 9ias I use wanted 1.3, so that is what I ended up using.)
    NOTE: I followed the 9-11 steps from the above note the first time and manually changed the files below, but when I had to reboot my machine a couple of days later it lost the changes. So I went in thru OEM and did it there and have had no problems. These steps are detailed below.
    2. Log into Oracle Enterprise Manager. Click on 9ias instance. Click OC4J_home.
    3. Go to Advanced Properties. Edit the default-web-site.xml file. Look for the statement <default-web-app application="default" name="defaultWebApp" root="/j2ee"/>. After that statement, add the following: <web-app application="default" name="cocoon" root="/cocoon"/>
    4. Go back to OC4J_home. Click on default link near the top of the page. (It has a Path underneath is that says application.xml) Then click on Advanced Properties. Edit the application.xml file. Look for the statement <web-module id="defaultWebApp" path="../../home/default-web-app"/>. After that statement, add the following: <web-module id="cocoon" path="../../home/applications/cocoon.war"/>.
    5. Go back to 9ias instance and do a "Restart All".
    B. SECOND SECTION ( Based off of Metalink note 184826.1)
    1. Go to the Apache/Apache/conf/mod_oc4j.conf file underneath your 9ias home. Add the following line at the bottom of the file: Oc4jMount /cocoon/* home
    Either "Restart All" from OEM again, or follow step 3 from the note. WARNING: I read somewhere that if you try to do the dos dcm/opmn stuff with the OEM at the same time, that you have corruption problems? So close the OEM if you do the dos commands just in case.
    C. THIRD SECTION (This is what I did with the Cocoon jars to make 9ias/oc4J find them and use them. I am by no means saying this is the correct way. Just a way. If anyone has a different way, I would appreciate hearing it.)
    1. Go to 9ias home and in the j2ee/home directory make a new folder. (I called mine xerces.) Copy the following jar files, found in the j2ee/home/applications/cocoon/web-inf/lib directory (this dir will show up after cocoon.war is deployed with the A. FIRST SECTION restart), into your new folder:
    a. batik-all-1.5b2.jar
    b. xalan-2.3.1.jar
    c. xercesImpl-2.0.0.jar
    d. xml-apis.jar
    2. Log into the Oracle Enterprise Manager. Click on OC4J_home. Click on Server Properties. Scroll down to the bottom and type the following into Java Options: -Djava.ext.dirs=xerces. (If you named your new folder xerces.)
    D. LAST SECTION
    1. I rebooted my machine and said a prayer. From the url "http://myhost:7777/cocoon/" I got the cocoon welcome page!

    I've heard rumors its about a month away. We were waiting for it, but then
    decided to go to Linux, as it probably performs better, and the release for
    Linux is already out. 9.0.2 is certified on Linux:
    - SuSe SLES7
    - Red Hat Advanced Server 2.1
    Waiting for Oracle to release a software product seems almost like waiting
    for a sunny day in Seattle -- you eventaly get it, but its unpredicatable
    as to when it will actually be at best...

  • Delete the specified character in a text file using RandomAccessFile

    Hi All,
    I have an invalid XML file which contains Return characters at the end of each line. I need to delete these return characters so the file becomes valid.
    Does anybody have any idea how this could be done using RandomAccessFile?
    I found joop_eggen's posting in this forum, modified it just a little and wanted to use it, but since the replacement character is "" (blank) it does not do what I need to.
    The XML file looks like this:
    <?xml version="1.0"?>
    <EPMSObject>
    <EPMSRecord><facilityname>KT0</facilityname><date_time>2007-06-01T00:00:00</date_time><devicetype>RPP</devicetype><devicename>RPP1A1_001.BCMF</devicename><meter>BCMF</meter><ckt_01_current>4.136000000000000e+000</ckt_01_current><ckt_02_current>0.000000000000000e+000</ckt_02_current><ckt_03_current>5.521000000000000e+000</ckt_03_current><ckt_04_current>0.000000000000000e+000</ckt_04_current><ckt_05_current>5.880000000000000e+000</ckt_05_current><ckt_06_current>0.000000000000000e+000</ckt_06_current><ckt_07_current>4.086000000000000e+000</ckt_07_current><ckt_08_current>0.000000000000000e+000</ckt_08_current><ckt_09_current>4.994000000000000e+000</ckt_09_current><ckt_10_current>0.000000000000000e+000</ckt_10_current><ckt_11_current>4.374000000000000e+000</ckt_11_current><ckt_12_current>0.000000000000000e+000</ckt_12_current><ckt_13_current>4.314000000000000e+000</ckt_13_current><ckt_14_current>0.000000000000000e+000</ckt_14_current><ckt_15_current>4.112000000000000e+000</ckt_15_current><ckt_16_current>0.000000000000000e+000</ckt_16_current><ckt_17_current>4.287000000000000e+000</ckt_17_current><ckt_18_current>0.000000000000000e+000</ckt_18_current><ckt_19_current>4.254000000000000e+000</ckt_19_current><ckt_20_current>0.000000000000000e+000</ckt_20_current><ckt_21_current>3.970000000000000e+000</ckt_21_current><ckt_22_current>0.000000000000000e+000</ckt_22_current><ckt_23_current>5.640000000000000e+000</ckt_23_current><ckt_24_current>0.000000000000000e+000</ckt_24_current><ckt_25_current>7.123000000000000e+000</ckt_25_current><ckt_26_current>0.000000000000000e+000</ckt_26_current><ckt_27_current>5.118000000000000e+000</ckt_27_current><ckt_28_current>0.000000000000000e+000</ckt_28_current><ckt_29_current>6.094000000000000e+000</ckt_29_current><ckt_30_current>0.000000000000000e+000</ckt_30_current><ckt_31_current>0.000000000000000e+000</ckt_31_current><ckt_32_current>0.000000000000000e+000</ckt_32_current><ckt_33_current>0.000000000000000e+000</ckt_33_current><ckt_34_current>0.000000000000000e+000</ckt_
    34_current><ckt_35_current>0.000000000000000e+000</ckt_35_current><ckt_36_current>0.000000000000000e+000</ckt_36_current><ckt_37_current>0.000000000000000e+000</ckt_37_current><ckt_38_current>0.000000000000000e+000</ckt_38_current><ckt_39_current>0.000000000000000e+000</ckt_39_current><ckt_40_current>0.000000000000000e+000</ckt_40_current><ckt_41_current>0.000000000000000e+000</ckt_41_current><ckt_42_current>0.000000000000000e+000</ckt_42_current></EPMSRecord>
    </EPMSObject>
    Here is joop_eggen's code:
    import java.io.*;
    import java.nio.*;
    import java.nio.channels.*;
    public class Patch {
      private static byte[] sought;
      private static byte[] replacement;
      private static boolean matches(MappedByteBuffer bb, int pos) {
        for (int j = 0; j < sought.length; ++j)
          if (sought[j] != bb.get(pos + j))
            return false;
        return true;
      private static void replace(MappedByteBuffer bb, int pos) {
        for (int j = 0; j < sought.length; ++j)
          byte b = (j < replacement.length)? replacement[j] : (byte)' ';
          bb.put(pos + j, b);
      private static void searchAndReplace(MappedByteBuffer bb, int sz) {
        int replacementsCount = 0;
        for (int pos = 0; pos <= sz - sought.length; ++pos)
          if (matches(bb, pos)) {
            replace(bb, pos);
            pos += sought.length - 1;
            ++replacementsCount;
        System.out.println("" + replacementsCount + " replacements done.");
        // Search for occurrences of the input pattern in the given file
        private static void patch(File f) throws IOException {
        // Open the file and then get a channel from the stream
        RandomAccessFile raf = new RandomAccessFile(f, "rw"); // "rws", "rwd"
        FileChannel fc = raf.getChannel();
        // Get the file's size and then map it into memory
        int sz = (int)fc.size();
        MappedByteBuffer bb = fc.map(FileChannel.MapMode.READ_WRITE, 0, sz);
        searchAndReplace(bb, sz);
        bb.force(); // Write back to file, like "flush()"
        // Close the channel and the stream
        raf.close();
        public static void main(String[] args) {
        String E_O_L;
        E_O_L = System.getProperty( "line.separator" );
        if (args.length == 0)
          args = new String[] { E_O_L, "", "C:\\GTI\\EPMSRecords.xml" };
        if (args.length < 3) {
          System.err.println("Usage: java Patch sought replacement file...");
          return;
        sought = args[0].getBytes();
        replacement = args[1].getBytes();
        //if (sought.length != replacement.length) {
          // Better build-in some support for padding with blanks.
          //System.err.println("Usage: sought (" + args[0] + ") and replacement (" + args[1] + ") must have same length");
          //return;
        for (int i = 2; i < args.length; i++) {
          File f = new File(args);
    try {
    patch(f);
    } catch (IOException x) {
    System.err.println(f + ": " + x);
    Thank you,
    Sinan Topuz

    Thank you all.
    Here is what I have right now and it works very well. It takes a couple of seconds to generate the second file and that satisfies me. I took the code sabre150 posted in this forum and changed it just a little bit, so thanks to him.
    I hope this helps someone.
    Sinan
    import java.io.*;
    public class SearchReplace{
        public static void main(String[] args){
            if(null == args || args.length < 2) {
               System.err.println("\nUsage: java <inputFileFullPath> <OutputFileFullPath> \nExample: java C:\\GTI\\Epmsrecord.xml C:\\GTI\\EpmsrecordNEW.xml");
               System.exit(1);
            Reader reader = null;
            Writer writer = null;
            try{
                char cr;
                char lf;
                char sp;
                int  indx;
                cr = '\r';
                lf = '\n';
                sp = ' ';
                indx = 0;
                reader = new FileReader(args[0]);
                writer = new FileWriter(args[1]);
                for (int ch = ' '; (ch = reader.read()) != -1;){
                    indx++;
                    if ( indx > 15 ) {      // Skip the first space character in <?xml version="1.0"?> otherwise the file becomes invaild!
                        if (ch != cr && ch != lf ) {
                            writer.write(ch);
                    }else{
                        writer.write(ch);
                System.out.println("\nFile " + args[1] + " has been successfully created.");
            }catch(FileNotFoundException fnfe){
                System.out.println("\nError : File " + args[0] + " not found. Please make sure it exists and you have rights to access to it.");
            }catch (IOException e) {
                System.err.println("Caught IOException: " +  e.getMessage());
            }finally {
                try {
                    if ( reader!=null ) {
                        reader.close();
                    if ( writer!=null ) {
                        writer.close();
                }catch (IOException e){
                    System.err.println("I/O error occured while trying to close the files.");
    }

  • How to install 9ifs into 9idb with 9iAS 1.0.2.2.2a in window 2000?

    Anyone know how to install 9ifs into 9idb with 9iAS 1.0.2.2.2a?

    Hi,
    9iFS must be installed in an 9i home type. So you must have it installed in a single box in your 9i DB home. You must use the Apache server of the DB, because the installer will modify the configuration files of this Apache, not this of 9iAS.
    After just modify the port the 9i apache is listening (use 81 instead of 80 for example).
    Be careful that if you install a new apache for the 9i database, your vw_gateway_cfg environment variable will be changed and will point to the 9i home instead of the 9ias home. So you have to change it back to your 9iAS home if you want to use the portal !!!!
    Regards
    Pierre

  • Database authentication with 9iAS

    Hi,
    I was wondering if anyone nows when it will be possible to use database authentication with 9iAS. I don't mean just removing the password from the DAD configuration and authentication that way. I want to be able to have basic Oracle authentication like in OAS.

    In the next release of iAS (towards end of year) single signon will be integrated with apache. At that time, it will be possible to do this.

  • Getting Headstart to work with 9iAS Release 2

    We have been working with Headstart6i through web forms using forms server that comes with 9iAS 1.0.2.2.2a on windows 2000.
    We moved to a 9i database and 9iAS Release 2. The new Forms server is running but I can't get Headstart to work through the web with the new 9iAS.
    I can get the starting page (hsustart.htm) and save the configuration of the new server, but when I hit Lanuch, I get an internal error.
    [Fri Aug  2 09:56:16 2002] [error] (8)Exec format error: exec of /mnt/rubella/apps/Oracle/hsd65/html/hsdcgi65 failed
    [Fri Aug  2 09:56:16 2002] [error] [client 10.1.1.31] Premature end of script headers: /mnt/rubella/apps/Oracle/hsd65/html/hsdcgi65
    I have checked the configuration files and they seem to be O.K.
    I am not sure if Headstart will work at all with the new app server. If it will work what do I need to setup differently?

    It seems that you don't have comm.jar in your classpath.

  • EBS 11i Adaptor certification with 9iAS/ 10g AS Interconnect and FMW 11g

    I'm trying to get three compatibility questions answered regarding the 9iAS / 10g Interconnect product to assist with upgrade planning:
    1. Is the EBS 11i Adaptor with 9iAS Interconnect certified when the underyling EBS database is Oracle 10g? (the certification page is not specific in this regards, it doesn't mention the underlying database release)
    2. Is the EBS 11i Adaptor with 10gAS Interconnect certified when the underyling EBS database is Oracle 10g?
    3. Does the EBS 11i adaptor for Fusion Middleware 11g work against an Oracle EBS 11i that is running on a 10g database?
    Thanks.

    Hi Pritesh,
    With Pleasure brother
    Is the  oracle application server 10g is required to install in my case.
    No, You don't need to worry about this, as you are not working with Portal.
    But just to clarify:
    When you upgrade from 11i to R12 application, then 10g Application Server will be automatically configured as R12 Application uses 10g Application Server by default.
    Please refer note:
    Interesting Documents Concerning E-Business Suite 11i to R12 Upgrades (Doc ID 850008.1)
    Database Preparation Guidelines for an E-Business Suite Release 12.1 Upgrade (Doc ID 761570.1)
    Planning Your Oracle E-Business Suite (EBS) Upgrade from Release 11i to Release 12 (Doc ID 1406960.1)
    Installing Oracle Application Server 10g with Oracle E-Business Suite Release 11i (Doc ID 233436.1)
    Hope this clarifies
    Thanks &
    Best Regards,

  • Get all object using RandomAccessFile

    hi friends,
    i have one log file and this log file contain some object. and i am used Serializable Interface.
    i know basically object are not readable format, but consider log file(logInfo.log) contain some object like:
    12 javasun
    20 sunjava
    38 java
    96 sun
    like wise
    am using RandomAccessFile class and this my
    raf.writeInt(baos.size());
    raf.write(baos.toByteArray());
    raf.seek(0);
    int a = 0;
    while(true)
    a = raf.readInt();
    System.out.println("The pointer Value : " + a);
    byte[] b = new byte[a+4];
    int x=(int)raf.getFilePointer();
    System.out.println("file Pointer : " + x);
    raf.read(b,x,a);
    ByteArrayInputStream bais = new ByteArrayInputStream(b,x,a);
    ObjectInputStream ois = new ObjectInputStream(bais);
    Record rec = (Record)ois.readObject(); //here record is object
    System.out.println("The object : "+rec.getAttributes());
    using this code i got below result
    12 javasun
    but i can't get all object from the file(logInfo.log)
    how can i get all object? help me!!!...
    Thank You

    ok, sir
    i tried and i got all object from the file. Thank
    you,
    and,
    if i need last two object from file(logInfo.log)
    like
    38 java
    96 sun
    how can i get? please give some clue or code
    Thank youSince you don't have a set size for the objects, then you will have to read through the entire file always keeping the last two objects, and as soon as the read fails return them.
    As I said in your first thread, however, you would be much better off writing the objects with a set size (i.e. calling ByteArrayOutputStream(size) with a single max size rather than ByteArrayOutputStream( ) ) as you would then be able to use seek adding 4 (for the int) to size and multiplying by the position of the recordset you want to read (0 for the first). You would then, also be able to overwrite records and the such (which is the usually one of the main reasons for using something like RandomAccessFile, i.e. creating a Flat DB-Like File).
    Edit:
    And you would probably lose the int, then anyway (when using a set size), as it wouldn't be needed.

  • Differnce between using RandomAccessFile and Outputstream

    Hi,
    I'm implementing a download manager , i read some source using RandomAccessFile and the other using Outbutstream and buffedOutputstream
    so any one can give me a quick summary between them and which is better ?

    BigDaddyLoveHandles wrote:
    sabre150 wrote:
    BigDaddyLoveHandles wrote:
    BigDaddyLoveHandles wrote:
    It's useless to speculate about unseen code written by an unknown hand.That's my {color:green}Phrase Of The Day.{color}Interesting that I also used the word 'speculate' but my brain must be slower than yours since I was a minute behind you!Don't you know that on Fridays it's useless trying to keep up with me? I wear my Ninja outfit!:-) I'm surprised you can get one that fits!

  • HT202667 Hi - My daughter was using her Apple TV until recently when she got a Smart TV.  Now the Apple TV is not needed so she passed it on to me.  How do I get it transferred over from her Home Sharing account to mine so that I can use it with my PC?

    Hi - My daughter was using her Apple TV until recently when she got a Smart TV.  Now the Apple TV is not needed so she passed it on to me.  How do I get her Home Sharing account transferred over to mine so that I can use it with my PC? Thanks!

    As  Winston Churchill wrote, however you might want to do a factory reset on the Apple TV.
    This way all information pertaining to your daughter will be removed from the device. Specifically if see was sign into any of the streaming service, Netflix, Hulu, etc. her credentials will still be associated with this Apple TV, doing  a factory reset will remove all that and make it as if you purchased the device and just plugged it in.
    regards

  • OPEN CURSOR using a WITH clause in the select query

    Hi,
    I am using Oracle 9i. I have a requirement where I have a REFCURSOR as an OUT parameter for my procedure. I have declared the TYPE and created the procedure.
    In the procedure, I am using OPEN <cursor_name> FOR <query>;
    Ideally this works in most of the cases that I have tried earlier. However, in the current case I am using a WITH clause in my query to get the results.
    I need help in understanding if the above mentioned syntax would not allow me to use the WITH clause in the query.

    What error do you get , seems to work ok for me on 10g
    SQL> begin
      2  open :cv for 'with x as (select * from emp)  select * from x';
      3  end;
      4  /
    PL/SQL procedure successfully completed.
    SQL> print :cv
         EMPNO
    ENAME
    JOB              MGR HIREDATE         SAL       COMM     DEPTNO
          7521
    WARD
    SALESMAN        7698 22-FEB-81       1250        500         30
          7566
    JONES
    MANAGER         7839 02-APR-81       2975                    20
         EMPNO

  • My iPhone 4 will not sync my new voice memos from the "Voice Memos" app to my computer. This is frustrating, should not be so hard, can someone please help. I use PC with windows 7 with iPhone version 6.1.3 and iTunes most recent. Thanks.

    My iPhone 4 will not sync my new voice memos from the "Voice Memos" app to my computer. This is frustrating, should not be so hard, can someone please help. I use PC with windows 7 with iPhone version 6.1.3 and iTunes most recent. Thanks.

    In the Music tab of iTunes, do you have 'Include Voice Memos' checked?

Maybe you are looking for

  • My calendar is stuck on the month view.

    How do I get back to the day view?  There are no options for day, month or year at the bottom of the screen.

  • How do I create an online PDF form that can be filled out by recipient?

    I have Create PDF Online and am wondering how I go about creating a document that can be filled out by a recipient.  This would be regarding a questionaire type form where I would ask questions and the recipient fills in the answers.  I know I have r

  • LSMW- Batch Input session getting error

    Hi All, I created LSMW object for Tcode KO01 and its creating the Internal order as expceted.But even after creating the document the Batch Input session status is showing incorrect.No messages are also displayed in the log. Please let me know why th

  • 9.2 client for linux

    Is it possible to download a 9.2 client for linux?

  • IPhone for a non-US citizen to use in US

    Hi! I will travel to US frequently this year and want to buy iPhone to function as my cellphone with all other features while I'm in US and as iPod and Internet device when I'm in Russia or any other country outside US. As I understood I must have a