Close netSream fails

hi
i have event listener in the main function:
netStream.addEventListener(NetStatusEvent.NET_STATUS, statusUpdated);
and function as follows:
public function statusUpdated(e:NetStatusEvent):void
    trace(e.info.code)
    switch (e.info.code)
    case "NetStream.Play.Stop":
    video.clear();
    gotoAndStop(1)
            break;
however i get the following error:
ReferenceError: Error #1069: Property onPlayStatus not found on Main and there is no default value.
Error #2044: Unhandled AsyncErrorEvent:. text=Error #2095: flash.net.NetStream was unable to invoke callback onPlayStatus. error=ReferenceError: Error #1069: Property onPlayStatus not found on Main and there is no default value.
          at Main()[/Users/test/Desktop/add_complete/Main.as:408]
NetStream.Buffer.Empty
need assistance
thanks

Apparently you are invoking RTMP stream. NetStream with streaming media behaves differently from progressive playback. In particular, server can invoke additional methods on NetStream instance.
FMS (or whatever server your video originates from) in your case is trying to call onPlayStatus() method on NetStream.client. This ia standard server behavior. With RTMP NetStream does not dispatch NetStatus Event with code NetStream.Play.Stop. Instead, again, server calls onPlayStatus() with code NetStream.Play.Complete.
Thus, as kglad suggested, you need to implement public method onPlayStatus() in your code.

Similar Messages

  • Lpthread causing close() to fail

    I'm noticing a bug that occurs whereby EBADF is being returned by the close() function randomly. The general test case does nothing but open()/dup()/close() a file channel over and over. If run on a multi-processor machine, with multiple processes running the same test case at the same time, WITHOUT -lpthreads, it runs like a charm. If I simply add -lpthread to the compile line (the program makes no use of threads, secondary processes, or anything else), I get random EBADF failures in the open()/dup()/close() routines.
    Anyone have any ideas?

    Please say which version of Solaris you're using.
    Does the problem only happen when you are running multlple copies
    of the process?
    What kind of open is it? Are you opening a file, a socket?
    I assume you are checking the return values of the open and dup calls, and
    all the other related system calls, right? If the open or dup fails, then the
    FD will have a bad value, and you would expect the close() to fail.
    --chris

  • IPhone: open()/close(), etc, fails, yet fopen()/fclose() works...why?

    I've just wasted about a days worth of development effort trying to figure out why my logging routines on the iPhone fail (while working on the simulator). I was using the standard C routines open/close/read/write. Their return values are valid, so imply they are working, yet no files are produced.
    I finally discovered in the docs that iPhone supposedly supports fopen()/fclose() etc .Since these are typically mere wrappers to the lower level functions they should fail also, but I gave them a shot and they work as advertised. So why the *((# should open() fail when fopen() works???
    grrrrr.....

    Because Apple told you not to call anything that wasn't in the documentation when you signed up for access to the SDK.

  • Close gesture fails after IOS 8

    Hi everyone! I've just started using this forum. I have an IPAD Air and since i updated it to the ios 8, i start having some "gestures" preblems.
    The thing is simply. When I try to close an app using the 4 fingers gesture, it just ignores it. So, i am forced to use the home button.
    As a temporary fix, I drop down the notification center. After I drag it down,  and then up, this issue seems to be corrected.
    I usually experience this bug after a short sleep period.
    Anyone else experienced the same??
    Im using IOS: 8.0.2 (12A405)

    Same here with a 1m cable. Another 1m cable is working just fine. One came with the iPhone when I bought it, the other I bought separately, but I couldn't tell now which one is which. I upgraded to 8.2 last night. Apple, what the f**k are you doing?

  • Cannot close tab groups. Close button fails even wtih empty window.

    When I create tab groups, I cannot close them. The red X close tab group button does not work. I can resize, add or remove sites, even remove all sites. But I cannot get the close tab group button to function.

    Hi,
    Please check if this happens in [https://support.mozilla.com/en-US/kb/Safe%20Mode Safe Mode].
    [http://kb.mozillazine.org/Problematic_extensions Problematic Extensions]
    [https://support.mozilla.com/en-US/kb/Troubleshooting%20extensions%20and%20themes Troubleshooting Extensions and Themes]
    [http://support.mozilla.com/en-US/kb/Uninstalling+add-ons Uninstalling Add-ons]
    [http://kb.mozillazine.org/Uninstalling_toolbars Uninstalling Toolbars]
    Safe mode disables the installed '''Extensions''', and themes ('''Appearance''') in '''Tools''' ('''Alt''' + '''T''') > '''Add-ons'''. Hardware acceleration is also temporarily disabled - the manual setting is '''Tools''' > '''Options''' > '''Advanced''' > '''General''' > '''Use hardware acceleration when available'''. [https://support.mozilla.org/en-US/kb/Options%20window%20-%20Advanced%20panel?as=u Options > Advanced]. All these settings/add-ons can also be individually or collectively disabled/enabled/changed in Firefox normal mode to check if an extension, theme or hardware acceleration is causing issues.

  • My iphoto freezes when trying to use the standard eBay photo upload, the problem started after a recent iOS 7 update. The album photos don't appear until I try and close the upload and immediately freezes. Attempts to close iphoto fail.

    A week or so ago I reacted to an Apple update message. The update completed and this left me with a couple of problems. When the imac started up there was a Glims message on screen telling me that the computer had not closed entirely and asking if I wanted to allow glims to reopen previously open files. I ticked yes and Safari froze immediately. This would happen even after a restart, Safari would start up with the Glims message on my Yahoo mail account. Then whether I clicked on the Glims message or not one of various adverts would appear and Safari would immediately freeze. I managed to override this by quickly entering Safari extensions and subscribing to an advertisement blocking programme. Safari now worked without problems but the blocking programme created other problems mostly with iphoto. The eBay uploaded photos were minute. So I decided to remove the Safari blocking extension and all seemed fine for everything except iphoto which now freezes every time I try to upload eBay photo's using the eBay standard upload problem. Yesterday I changed to the other BASIC upload option and that did work. Thought it might be a one of glitch on the Standard but obviously not. Anyone's help would be appreciated. I note that at least one other member is experiencing the same or similar problem today.

    Sorry I am 70 and not very computer literate. Please explain in simpler terms. Perhaps I should have said Apple update for my iMac. It did however include an iphoto update. My imac is 3 years old, I also have an ipad 2 and iPhone and both received iOS 7 updates around the same time.

  • New iMac 750 GB Hard Drive Fail Smart Drive Test - Glitch or Problem

    Greetings!
    I have a new 24" imac with 750 GB hard drive which has had problems out of the box (system crashing several times a day/unable to re-start/application crashes/general sluggishness).
    Five re-installs of Leopard (upgrade/clean install/install and erase)in five weeks when I finally used the latest version of Drive Genius and TechTool Pro (4.6.1). Both claimed hard drive problems. Specifically, TechTool Pro reported smart drive failure (see report below, please).
    This seemed to confirm my suspicions that something was flawed with my iMac from the start.
    I have returned the computer for a new hard drive.
    The Apple-approved repair shop says they've installed a new 750 GB had drive sent by Apple and when they run TechTool Pro, they get the same smart drive failure report. The techie claims this is either a glitch with TechTool Pro, or with the hard drive, but that I have nothing to worry about.
    What's your opinion?
    Many thanks for taking the time to read this.
    SMART
    Saturday, December 29, 2007 1:18:12 AM US/Pacific
    S.M.A.R.T. Self-Checks <Failing!>
    Model: ST3750640AS Q
    Mount Point: /dev/disk0
    Capacity: 698.64 GB
    Writable: Yes
    Ejectable: No
    Removable: No
    Bus: Serial ATA
    Bus Location: Internal
    Revision: 3.BTH
    Serial Number: 5QD2JVNE
    disk0s2: Ma
    disk0s3: Pa
    disk0s4: Peppi
    S.M.A.R.T. stands for Self-Monitoring Analysis and Reporting Technology. This test checks and reports on the status of the S.M.A.R.T. routines built into your drive. These routines monitor important drive parameters as your drive is operating. An examination and analysis of these parameters can aid in the prediction of drive failure. This will allow you to back up your data before your drive fails and the data becomes inaccessible.
    S.M.A.R.T. Self-Checks
    Attribute Normal Worst Threshold Status
    1 Read Raw Error Rate
    100 253 6 Okay
    3 Spin Up Time
    95 92 0 Okay
    4 Start/Stop Count
    100 100 20 Okay
    5 Reallocated Sectors
    100 100 36 Okay
    7 Seek Error Rate
    78 60 30 Okay
    9 Power On Hours
    100 100 0 Okay
    10 Spin Retry Count
    100 100 97 Okay
    12 Power Cycle Count
    100 100 20 Okay
    187 Unknown
    100 100 0 Okay
    189 Unknown
    100 100 0 Okay
    190 Unknown
    41 37 45 Failing!
    194 Temperature
    59 63 0 Okay
    195 HW ECC Recovered
    63 61 0 Okay
    197 Current Pending Sector Count
    100 100 0 Okay
    198 Off-Line Scan Uncorrectable Sector Count
    100 100 0 Okay
    199 Ultra DMA CRC Error Count (Rate)
    200 200 0 Okay
    200 Write Error Count
    100 253 0 Okay
    202 DAM Error Count
    100 253 0 Okay
    S.M.A.R.T. Self-Checks <Failing!>
    Tests Completed
    Threshold levels are exceeded occasionally. You should consider backing up your data from the hard drive. You should continue to check the hard drive for failures.
    S.M.A.R.T. Self-Checks <Failing!>
    -end-

    Greetings, all!
    This has been my first posting, despite having owned 5 Macs over twelve years - which goes to show you how reliable they are, most of the time.
    I am very impressed with the thoughtful responses, and I really, really appreciate you taking the time to respond.
    Here's an update since my last posting. I picked up my repaired(?) iMac from the Apple-approved repair shop. The technician's report said (referring to the original hard drive Seagate ST3750640AS Q) "The drive has passed and boots into the OS without issue. Confirmed the smart status of the hard drive shows failed, but this is for an unknown attribute. This may not really indicate the drive is failing, but could be a possibility. Since all of the other tests have passed, I feel it is best to replace the drive under warranty for the customer.
    About the new hard drive, the technician wrote: I have run a third-party smart utility on the (new, replaced) hard drive again and I have found that it is failing with the same error. The Apple test shows the smart status as OK.
    I have researched this error and I have found that this attribute appears to be for temperature. Since both drives showed the exact same error, this attribute can be safely ignored for smart status. I was not able to replicate any issues with this machine other than the smart status failure so I do not think there is any other hardware failing in this machine.
    If the customer continues to have issues, I would recommend reinstalling the OS one more time. If the issue still persists after this, then the customer should bring in the computer when issues are still happening so we can try to determine the cause of the problem better.
    At first, my iMac was performing much better, but as I began to migrate data from back-up, I was not able to connect/re-establish my iphoto library, or re-establish my Apple mail accounts( both of which I have done countless times in the past without hassle).
    I decided to run Apple's Disk utility which reports it cannot repair the new drive.
    Just prior to my original posting, I had sent a copy of my posting to Micromat (TechTool Pro) asking for their opinion/advice.
    Their response was: The SMART routines are built into the hard drive by the drive manufacturer. They are proprietary and different for each drive manufacturer. TechTool Pro just reads the status of the built-in SMART parameters and reports their status. Basically, a threshold exceeded indicates that the drive has exceeded what the manufacturer thinks are proper operating parameters for it and it may be getting close to failing. For an interpretation of the seriousness of a specific attribute failure you would need to contact the drive manufacturer. A failure is a warning to be sure to keep good backups and consider replacing the drive. If you get a SMART failure on a drive that is under warranty, the drive manufacturer will typically replace the drive.
    Following are two links that might be of interest:
    http://www.ariolic.com/activesmart/docs/glossary.html
    http://www.ariolic.com/activesmart/docs/smart-attribute-meaning.html
    I also took your (Looby) advice and called Seagate. (I also visited their web site, which recommends replacement of their hard drive under these circumstances!)
    Within a couple of minutes, the tech person agreed that this is a serious concern and I should replace the drive.
    Regarding Wiil's post, Apple's Disk utility says: smart status verified.
    The SmartReporter utility reports the smart status is OK.
    The SmartUtility application says:smart status failed. ID: #190 Unknown attribute.
    For all other posters, this was not a New Egg purchase, which was not relevant to my post. Thank you just the same.
    I've left a message for the Apple-approved store and will ask for another drive, and that, if possible, it be tested before I bring my iMac in to reduce the inconvenience.
    I'm also wondering if I should switch to a 500 GB hard drive, although that would defeat the purpose of buying the larger drive for all the video I work with ( I have another 2 Terabytes storage with external drives).
    Any further comments welcome - and thank you all again for taking the time!

  • "Delete and close gap" stopped working

    Another first: In one project, but not in others, "Delete and close gap" will only work if I delete complete clips. If I try to trim a clip, either in the Timeline, or in the Sceneline by trimming in-points or out-points in the mini-timeline under the Monitor screen, a gap created by trimming a scene does not close up.
    Stranger still -- Trying another approach to trimming a particular clip, I split it, then tried to delete one of the two new clips using "Delete and close gap. It deleted the new clip but did not close the gap. The action created a black clip image in the Sceneline where the deleted clip had bin, and this new black clip image could not be deleted.
    In the Timeline, it is possible to drag the following scenes over to close the newly-created gap, but it's time-consuming. It's a drag, so to speak.
    I'm almost done editing the project in question and can complete it without solving this problem, but if I suffered a similar loss of the ability to trim clips in a longer project without creating gaps in the clip sequence, or if "Delete and close gap" failed to work on split clips, I would very much want to know why, and how to restore the lost ability.
    Has anyone experienced anything similar?
    John B

    Thanks, Robert -- You nailed it on your first guess. In this project, for the first time ever, I dragged an audio track to the Narration track. I know it's intended for narration that's recorded directly into PE, but I thought I'd see if I could use it as an extra track.
    Also in this project, I've split the audio on the Soundtrack so it's non-continuous, with gaps in it, because I only need it in certain places. From your 2nd message, it's possible this could also be a/the cause of the problem.
    I'll keep a close eye on my use of these tracks. In other projects, I have imported audio into the Soundtrack track without causing this problem, but those were continuous music tracks with no gaps.
    Another lesson learned.
    Thanks!
    John B

  • LoadState: "LookupAccountSid failed"

    I'm attempting a Task Sequence using hardlinks offline. Files are being captured fine but the restore part is bombing out. My smsts.log is saying "Not enough storage is available to complete this operation." but the loadstate.log is saying "LookupAccountSid
    failed for S-1-5-21-3233480790-567902233-3410887031-71480" and "USMT error code 14: [gle=0x00000012]". The only thing I can think is that the name of the computer is changing during the imaging process. Could this be causing the issue and is
    there any way to get around it? Thanks!

    Okay, that makes sense now... and it is possible that the specific SID account doesn't exist, but it gave the same error for an account that I know exists. I just tried the same task sequence on another computer and it worked perfectly. In the case of the
    failed task sequence, I got the LookupAccountSid error 17 times (one for each domain account that was on the machine) followed by the local "admin" account. The SID account I posted in my original question was a domain account.
    Now I'm even more confused since it worked on another machine. It seems like an isolated issue, but I would like to know what caused it because this particular computer was a bad one for it to mess up on. :)
    This is my loadstate.log:
    2014-06-26 12:46:11, Info [0x000000] LOADSTATE.EXE Version 6.2.9200.16384[gle=0x000000b7]
    2014-06-26 12:46:11, Info [0x000000] USMT Started at 2014/06/26:12:46:11.542
    2014-06-26 12:46:11, Info [0x000000] Command line: C:\_SMSTaskSequence\Packages\PRI00047\amd64\loadstate.exe C:\_SMSTaskSequence\UserState /ue:JS-RM105-HSCP3P1\* /c /hardlink /nocompress /l:C:\Windows\CCM\Logs\SMSTSLog\loadstate.log /progress:C:\Windows\CCM\Logs\SMSTSLog\loadstateprogress.log /i:C:\_SMSTaskSequence\Packages\PRI00047\amd64\MigApp.xml /i:C:\_SMSTaskSequence\Packages\PRI00047\amd64\MigUser.xml /i:C:\_SMSTaskSequence\Packages\PRI00047\amd64\MigDocs.xml /i:C:\_SMSTaskSequence\Packages\PRI00047\amd64\Wallpaper.xml
    2014-06-26 12:46:11, Info [0x000000] Script file specified: C:\_SMSTaskSequence\Packages\PRI00047\amd64\MigApp.xml[gle=0x000000cb]
    2014-06-26 12:46:11, Info [0x000000] Script file specified: C:\_SMSTaskSequence\Packages\PRI00047\amd64\MigUser.xml[gle=0x000000cb]
    2014-06-26 12:46:11, Info [0x000000] Script file specified: C:\_SMSTaskSequence\Packages\PRI00047\amd64\MigDocs.xml[gle=0x000000cb]
    2014-06-26 12:46:11, Info [0x000000] Script file specified: C:\_SMSTaskSequence\Packages\PRI00047\amd64\Wallpaper.xml[gle=0x000000cb]
    2014-06-26 12:46:11, Info [0x000000] Starting the migration process[gle=0x00000006]
    2014-06-26 12:46:14, Warning [0x0803ec] Registry location HKCU\Software\Microsoft\Windows Live Mail [Store Root] is considered invalid in the current context
    2014-06-26 12:46:14, Warning [0x0803ec] Registry location HKCU\Software\Microsoft\Works\9.0\Common\Templates [TemplateDirectory] is considered invalid in the current context
    2014-06-26 12:46:14, Warning [0x0803ec] Registry location HKCU\Software\Microsoft\Office\14.0\OneNote\General [CachePath] is considered invalid in the current context
    2014-06-26 12:46:24, Info [0x000000] System information:
    Computer name: SEVHSCP3P1
    Machine SID: S-1-5-21-3223694542-2909517733-2420482520
    OS version: 6.1.7601.Service Pack 1
    Language: en-US
    Architecture: 64-bit
    Drives:
    C: Type: Fixed, Bus type: ATA, Hotplug: No
    D: Type: CD/DVD
    Users:
    SEVHSCP3P1\Guest, administrator: No, interactive: Yes, logged on: No, has profile: No
    SEVHSCP3P1\Administrator, administrator: Yes, interactive: Yes, logged on: No, has profile: No
    2014-06-26 12:46:24, Info [0x000000] Processing the settings store[gle=0x00000006]
    2014-06-26 12:46:33, Info [0x000000] Selecting migration units
    [gle=0x00000006]
    2014-06-26 12:46:33, Warning [0x000000] LookupAccountSid failed for S-1-5-21-3233480790-567902233-3410887031-71480. Error: 0x00000534
    2014-06-26 12:46:33, Warning [0x000000] LookupAccountSid failed for S-1-5-21-3233480790-567902233-3410887031-75995. Error: 0x00000534
    2014-06-26 12:46:33, Warning [0x000000] LookupAccountSid failed for S-1-5-21-3233480790-567902233-3410887031-71479. Error: 0x00000534
    2014-06-26 12:46:33, Warning [0x000000] LookupAccountSid failed for S-1-5-21-3233480790-567902233-3410887031-93902. Error: 0x00000534
    2014-06-26 12:46:33, Warning [0x000000] LookupAccountSid failed for S-1-5-21-3233480790-567902233-3410887031-84548. Error: 0x00000534
    2014-06-26 12:46:33, Warning [0x000000] LookupAccountSid failed for S-1-5-21-3233480790-567902233-3410887031-71321. Error: 0x00000534
    2014-06-26 12:46:33, Warning [0x000000] LookupAccountSid failed for S-1-5-21-3233480790-567902233-3410887031-71377. Error: 0x00000534
    2014-06-26 12:46:33, Warning [0x000000] LookupAccountSid failed for S-1-5-21-3233480790-567902233-3410887031-71339. Error: 0x00000534
    2014-06-26 12:46:33, Warning [0x000000] LookupAccountSid failed for S-1-5-21-3233480790-567902233-3410887031-71462. Error: 0x00000534
    2014-06-26 12:46:33, Warning [0x000000] LookupAccountSid failed for S-1-5-21-3233480790-567902233-3410887031-71429. Error: 0x00000534
    2014-06-26 12:46:33, Warning [0x000000] LookupAccountSid failed for S-1-5-21-3233480790-567902233-3410887031-71396. Error: 0x00000534
    2014-06-26 12:46:33, Warning [0x000000] LookupAccountSid failed for S-1-5-21-3233480790-567902233-3410887031-71513. Error: 0x00000534
    2014-06-26 12:46:33, Warning [0x000000] LookupAccountSid failed for S-1-5-21-3233480790-567902233-3410887031-81056. Error: 0x00000534
    2014-06-26 12:46:33, Warning [0x000000] LookupAccountSid failed for S-1-5-21-3233480790-567902233-3410887031-71480. Error: 0x00000534
    2014-06-26 12:46:33, Warning [0x000000] LookupAccountSid failed for S-1-5-21-3233480790-567902233-3410887031-75995. Error: 0x00000534
    2014-06-26 12:46:33, Warning [0x000000] LookupAccountSid failed for S-1-5-21-3233480790-567902233-3410887031-71479. Error: 0x00000534
    2014-06-26 12:46:33, Warning [0x000000] LookupAccountSid failed for S-1-5-21-3233480790-567902233-3410887031-93902. Error: 0x00000534
    2014-06-26 12:46:33, Error [0x000000] The account JS-RM105-HSCP3P\admin is chosen for migration, but the target does not have account SEVHSCP3P1\admin. See documentation on /lac, /lae, /ui, /ue and /uel options.[gle=0x00000534]
    2014-06-26 12:46:33, Info [0x000000] Failed.[gle=0x00000006]
    2014-06-26 12:46:33, Info [0x000000] Unable to create a local account because /lac was not specified[gle=0x00000006]
    2014-06-26 12:46:33, Error [0x0802f5] CMediaManager::Close: m_pSelectedTransport->Close(1) failed with Exception Win32Exception: Device was open with readonly access.: Access is denied. [0x00000005] void __cdecl Mig::CMediaManager::CloseTransport(int)
    void __cdecl Mig::CUNCTransport::Close(int).[gle=0x00000006]
    2014-06-26 12:46:33, Error [0x000000] MigCloseCurrentStore caught exception: Win32Exception: Device was open with readonly access.: Access is denied. [0x00000005] void __cdecl Mig::CMediaManager::CloseTransport(int)
    void __cdecl Mig::CUNCTransport::Close(int)[gle=0x00000006]
    2014-06-26 12:46:33, Info [0x000000] USMT Completed at 2014/06/26:12:46:33.673[gle=0x00000006]
    2014-06-26 12:46:33, Info [0x000000] ----------------------------------- USMT ERROR SUMMARY -----------------------------------[gle=0x00000012]
    2014-06-26 12:46:33, Info [0x000000] * USMT error code 14: [gle=0x00000012]
    2014-06-26 12:46:33, Info [0x000000] +-----------------------------------------------------------------------------------------[gle=0x00000012]
    2014-06-26 12:46:33, Info [0x000000] | Unable to create a local account because /lac was not specified[gle=0x00000012]
    2014-06-26 12:46:33, Info [0x000000] +-----------------------------------------------------------------------------------------[gle=0x00000012]
    The relevant section of scanstateprogress.log:
    26 Jun 2014, 11:53:41 -04:00, 00:01:44, PHASE, Collecting
    26 Jun 2014, 11:53:41 -04:00, 00:01:44, processingUser, S-1-5-21-3233480790-567902233-3410887031-75995
    26 Jun 2014, 11:53:41 -04:00, 00:01:44, totalPercentageCompleted, 1
    26 Jun 2014, 11:53:43 -04:00, 00:01:46, processingUser, S-1-5-21-3233480790-567902233-3410887031-71480
    26 Jun 2014, 11:53:43 -04:00, 00:01:46, totalPercentageCompleted, 1
    26 Jun 2014, 11:53:44 -04:00, 00:01:47, processingUser, S-1-5-21-3233480790-567902233-3410887031-1548
    26 Jun 2014, 11:53:44 -04:00, 00:01:47, totalPercentageCompleted, 1
    26 Jun 2014, 11:53:45 -04:00, 00:01:49, processingUser, S-1-5-21-3233480790-567902233-3410887031-93902
    26 Jun 2014, 11:53:45 -04:00, 00:01:49, totalPercentageCompleted, 1
    26 Jun 2014, 11:53:47 -04:00, 00:01:50, processingUser, S-1-5-21-3233480790-567902233-3410887031-71479
    26 Jun 2014, 11:53:47 -04:00, 00:01:50, totalPercentageCompleted, 1
    26 Jun 2014, 11:53:48 -04:00, 00:01:51, processingUser, S-1-5-21-1123561945-2139871995-1801674531-500
    26 Jun 2014, 11:53:48 -04:00, 00:01:51, totalPercentageCompleted, 1
    26 Jun 2014, 11:53:49 -04:00, 00:01:53, processingUser, S-1-5-21-3233480790-567902233-3410887031-84548
    26 Jun 2014, 11:53:49 -04:00, 00:01:53, totalPercentageCompleted, 1
    26 Jun 2014, 11:53:50 -04:00, 00:01:54, processingUser, S-1-5-21-1123561945-2139871995-1801674531-1003
    26 Jun 2014, 11:53:50 -04:00, 00:01:54, totalPercentageCompleted, 1
    26 Jun 2014, 11:53:52 -04:00, 00:01:55, processingUser, S-1-5-21-3233480790-567902233-3410887031-71321
    26 Jun 2014, 11:53:52 -04:00, 00:01:55, totalPercentageCompleted, 1
    26 Jun 2014, 11:53:53 -04:00, 00:01:56, processingUser, S-1-5-21-3233480790-567902233-3410887031-29012
    26 Jun 2014, 11:53:53 -04:00, 00:01:56, totalPercentageCompleted, 1
    26 Jun 2014, 11:53:54 -04:00, 00:01:58, processingUser, S-1-5-21-3233480790-567902233-3410887031-19887
    26 Jun 2014, 11:53:54 -04:00, 00:01:58, totalPercentageCompleted, 1
    26 Jun 2014, 11:53:55 -04:00, 00:01:59, processingUser, S-1-5-21-3233480790-567902233-3410887031-16649
    26 Jun 2014, 11:53:55 -04:00, 00:01:59, totalPercentageCompleted, 1
    26 Jun 2014, 11:53:57 -04:00, 00:02:00, processingUser, S-1-5-21-3233480790-567902233-3410887031-71377
    26 Jun 2014, 11:53:57 -04:00, 00:02:00, totalPercentageCompleted, 1
    26 Jun 2014, 11:53:58 -04:00, 00:02:01, processingUser, S-1-5-21-3233480790-567902233-3410887031-71339
    26 Jun 2014, 11:53:58 -04:00, 00:02:01, totalPercentageCompleted, 1
    26 Jun 2014, 11:54:00 -04:00, 00:02:03, processingUser, S-1-5-21-3233480790-567902233-3410887031-71462
    26 Jun 2014, 11:54:00 -04:00, 00:02:03, totalPercentageCompleted, 1
    26 Jun 2014, 11:54:01 -04:00, 00:02:04, processingUser, S-1-5-21-3233480790-567902233-3410887031-71429
    26 Jun 2014, 11:54:01 -04:00, 00:02:04, totalPercentageCompleted, 1
    26 Jun 2014, 11:54:02 -04:00, 00:02:06, processingUser, S-1-5-21-3233480790-567902233-3410887031-71396
    26 Jun 2014, 11:54:02 -04:00, 00:02:06, totalPercentageCompleted, 1
    26 Jun 2014, 11:54:03 -04:00, 00:02:06, processingUser, S-1-5-21-3233480790-567902233-3410887031-81056
    26 Jun 2014, 11:54:03 -04:00, 00:02:06, totalPercentageCompleted, 1
    26 Jun 2014, 11:54:05 -04:00, 00:02:08, processingUser, S-1-5-21-3233480790-567902233-3410887031-71513
    26 Jun 2014, 11:54:05 -04:00, 00:02:08, totalPercentageCompleted, 1
    26 Jun 2014, 11:54:06 -04:00, 00:02:10, processingUser, S-1-5-21-3233480790-567902233-3410887031-1551
    26 Jun 2014, 11:54:06 -04:00, 00:02:10, totalPercentageCompleted, 1
    26 Jun 2014, 11:54:10 -04:00, 00:02:14, totalPercentageCompleted, 13
    26 Jun 2014, 11:54:14 -04:00, 00:02:18, totalPercentageCompleted, 20
    26 Jun 2014, 11:54:18 -04:00, 00:02:22, totalPercentageCompleted, 29
    26 Jun 2014, 11:54:22 -04:00, 00:02:26, totalPercentageCompleted, 40
    26 Jun 2014, 11:54:26 -04:00, 00:02:30, totalPercentageCompleted, 46
    26 Jun 2014, 11:54:30 -04:00, 00:02:34, totalPercentageCompleted, 62
    26 Jun 2014, 11:54:34 -04:00, 00:02:38, totalPercentageCompleted, 85
    26 Jun 2014, 11:54:38 -04:00, 00:02:42, totalPercentageCompleted, 92
    26 Jun 2014, 11:54:43 -04:00, 00:02:46, processingUser, SYSTEM
    26 Jun 2014, 11:54:43 -04:00, 00:02:46, totalPercentageCompleted, 92
    26 Jun 2014, 11:54:50 -04:00, 00:02:54, totalPercentageCompleted, 94
    26 Jun 2014, 11:54:55 -04:00, 00:02:59, totalPercentageCompleted, 94
    26 Jun 2014, 11:54:56 -04:00, 00:02:59, PHASE, Saving
    26 Jun 2014, 11:54:57 -04:00, 00:03:01, totalPercentageCompleted, 100
    26 Jun 2014, 11:54:57 -04:00, 00:03:01, errorCode, 0, numberOfIgnoredErrors, 0, message, "Successful run"

  • How to find the job has failed in back ground

    Hi All,
        I have a requirement where i will be running a report online and background.
    If my job has failed in Background, then i have to trigger a mail to the user stating that the job has been terminated.
    Now, How will i know the Job has failed and how should i handle this in my report so as to trigger a mail.
    Hope i am clear with my requirement.Kindly clarify if possibe with any func modules or sample codings.
    Thanks in advance
    Nanda

    Hi try that:
    try:
    1) fm job_open
    2) submit report
    3) fm job_close
    4) finally select table TBTCO
    example:
    DATA: jobcount_test LIKE tbtcjob-jobcount,
            job_released    LIKE btch0000-char1,
            rcode(2),
            strtimmed LIKE btch0000-char1 VALUE 'X'.
      DATA jobname  LIKE tbtcjob-jobname.
      CONCATENATE  'TEST_' sy-repid '_' sy-datum INTO jobname.
      CALL FUNCTION 'JOB_OPEN'
           EXPORTING
                jobname          = jobname
           IMPORTING
                jobcount         = jobcount_test
           EXCEPTIONS
                cant_create_job  = 1
                invalid_job_data = 2
                jobname_missing  = 3
                OTHERS           = 4.
      IF sy-subrc NE 0.
        MESSAGE x000(yp) WITH 'JOB-START ' jobname ' failed !!!'.
      ELSE.
    *--Step insert
        SUBMIT rsbdcsub
        USER sy-uname VIA JOB jobname NUMBER jobcount_test
        WITH mappe = map
        WITH von = pdatum
        WITH z_verarb = 'X'
        AND RETURN .
        CALL FUNCTION 'JOB_CLOSE'
             EXPORTING
                  jobcount             = jobcount_test
                  jobname              = jobname
                  strtimmed            = strtimmed
                  targetsystem         = sy-host
             IMPORTING
                  job_was_released     = job_released
             EXCEPTIONS
                  cant_start_immediate = 1
                  invalid_startdate    = 2
                  jobname_missing      = 3
                  job_close_failed     = 4
                  job_nosteps          = 5
                  job_notex            = 6
                  lock_failed          = 7
                  OTHERS               = 8.
        IF sy-subrc > 1.
          MESSAGE x000(yp) WITH 'JOB-CLOSE ' jobname ' failed!!!'.
        ENDIF.
      ENDIF.
    Andreas

  • URL failed to open

    Hi
    I am trying to open a url : "http://www.legislature.state.oh.us/acts.cfm?GenAssem=122" through the URL Object using the following code :
    URL u = new URL("http","192.168.0.1",808,link);
    //link = "http://www.legislature.state.oh.us/acts.cfm?GenAssem=122"
    BufferedReader in = new BufferedReader(new InputStreamReader(u.openStream()));
    String str;
    while ((str=in.readLine()) != null)
    inputstr = inputstr + str;
    in.close
    I fail to get the entire text on the page, getting only a small portion of the text in the String str. But the same link is opening through a control (frmInet) in dot Net.
    Is there any thing wrong in the code.
    Are there other Classes availbale for opening a URL in Java.
    I have also used Socket (without help).
    Thanks in advance

    Thanks cottonm.
    Actually we have a proxy set up. So, we are required to use the LAN Setting. The same code is working for other URLs, But not for this particular URL. Suppose I want to open this URL :
    "http://www3.state.id.us/oasis/2006/minidata.html"
    The code works and opens it.
    But fails to open this "http://www.legislature.state.oh.us/acts.cfm?GenAssem=122".
    If I remove the Proxy setting, the code works.
    But I guess I will have to stick to the Proxy set up and find an alternative there.
    Thanks again

  • If you need to FTP with PL/SQL...

    If you need to perform FTP from within PL/SQL and your database version has the UTL_TCP package, here is a free package you can use. The source code is hopefully documented well enough for you to tell what's going on and how to use the functions. Suggestions on improving the code are welcome, and I can provide limited support via email for what I've written, but I would encourage anyone who uses the code to modify/fix it according to their needs. If you modify the code, I respectfully request that you leave intact the authorship and note comments at the beginning of the package.
    Please note that I have not rigorously tested this code, but it has successfully transferred files in both directions in the limited tests that I have performed.
    -- Copy the code below and run it in your favorite SQL editor --
    CREATE OR REPLACE PACKAGE FTP IS
    Simplified FTP client API using UTL_TCP package
    Author: Alan Wessman, Brigham Young University
    Note: This FTP client attempts to adhere to the protocol and advice found at:
    http://cr.yp.to/ftp.html
    No warranties are made regarding the correctness of this code.
    Notes:
    1. Most of these functions will raise UTL_TCP.NETWORK_ERROR if the connection
    is not open or is reset during the network transaction. They will also
    raise VALUE_ERROR if the server response is ill-formed or a buffer is
    too small to hold data. (Most buffers in this package are defined as
    VARCHAR2(32767) to avoid size limitations; reduce this if memory overhead
    is a concern.)
    2. "Verbose mode" can be enabled/disabled by changing the default value of
    the vDebug variable in the package body. Setting vDebug to TRUE will
    cause a session transcript to be output to DBMS_OUTPUT.
    3. The following is an example of how this package might be used:
    declare
    c utl_tcp.connection;
    vresp varchar2(32767);
    vbuf varchar2(32767);
    vresp_code number;
    vremote_host varchar2(32) := 'some.hostname.com';
    vusername varchar2(8) := 'username';
    vpassword varchar2(8) := 'password';
    begin
    dbms_output.put_line( 'Opening session...' );
    vresp_code := ftp.open_session( c,
    vremote_host,
    vusername,
    vpassword,
    vresp,
    5 );
    vresp_code := ftp.put( c,
    '/home/somebody',
    'local.test',
    'remote.test',
    vresp );
    vresp_code := ftp.remote_command( c, 'CHMOD 660 remote.test' );
    vresp_code := ftp.chdir( c, '/home/somebody/subdir' );
    vresp_code := ftp.pwd( c );
    vresp_code := ftp.get( c,
    '/home/somebody',
    'new_file.test',
    'another_remote_file.test',
    vresp );
    vresp_code := ftp.close_session( c );
    dbms_output.put_line( 'Closed session.' );
    exception
    when others then dbms_output.put_line( sqlcode || ':' || sqlerrm );
    end;
    Function: Open_Session
    Description: Begins an FTP session with the remote server.
    Parameters:
    conn OUT parameter that contains the connection info; to be passed
    in to subsequent commands to maintain session state.
    host Name or IP address of remote server
    username User ID to use for login
    password Password to use for login
    response OUT parameter; buffer for server replies
    timeout_secs Number of seconds for TCP timeout. Pass in NULL to disable
    timeout (wait forever for responses). Pass in 0 (zero) for
    no wait.
    Return value: 0 (zero) if operation is successful; FTP error code if operation
    is not successful.
    Exceptions: May raise UTL_TCP.NETWORK_ERROR if host parameter is incorrect or if
    some other networking error occurs.
    May raise VALUE_ERROR if server response is ill-formed.
    FUNCTION Open_Session( conn OUT NOCOPY UTL_TCP.Connection,
    host IN VARCHAR2,
    username IN VARCHAR2,
    password IN VARCHAR2,
    response OUT VARCHAR2,
    timeout_secs IN NUMBER DEFAULT 60 ) RETURN NUMBER;
    Function: Get
    Description: Retrieves a file on the remote server and stores its contents in
    a VARCHAR2 buffer.
    Parameters:
    conn IN OUT parameter that contains the connection info; to be
    passed in to subsequent commands to maintain session state.
    buf OUT parameter; buffer for retrieved file contents
    remote_path Pathname (including file name) indicating location of remote
    file to be retrieved
    response OUT parameter; buffer for server replies.
    Return value: 0 (zero) if operation is successful; FTP error code if operation
    is not successful.
    Exceptions: May raise UTL_TCP.NETWORK_ERROR if some networking error occurs.
    May raise VALUE_ERROR if server response is ill-formed or buf is
    too small for file contents.
    FUNCTION Get( conn IN OUT NOCOPY UTL_TCP.Connection,
    buf OUT VARCHAR2,
    remote_path IN VARCHAR2,
    response OUT VARCHAR2 ) RETURN NUMBER;
    Function: Get
    Description: Retrieves a file on the remote server and stores its contents in
    a local file. Assumes an open file handle and does not close it.
    Parameters:
    conn IN OUT parameter that contains the connection info; to be
    passed in to subsequent commands to maintain session state.
    local_file IN OUT parameter; UTL_FILE file handle for input file. File
    is assumed to be open for writing.
    remote_path Pathname (including file name) indicating location of remote
    file to be retrieved
    response OUT parameter; buffer for server replies.
    Return value: 0 (zero) if operation is successful; FTP error code if operation
    is not successful.
    Exceptions: May raise UTL_TCP.NETWORK_ERROR if some networking error occurs.
    May raise VALUE_ERROR if server response is ill-formed or buf is
    too small for file contents.
    May raise any of the UTL_FILE exceptions if file write operations
    fail. See UTL_FILE documentation for additional details.
    FUNCTION Get( conn IN OUT NOCOPY UTL_TCP.Connection,
    local_file IN OUT UTL_FILE.File_Type,
    remote_path IN VARCHAR2,
    response OUT VARCHAR2 ) RETURN NUMBER;
    Function: Get
    Description: Retrieves a file on the remote server and stores its contents in
    a local file. Opens and closes local file automatically.
    Parameters:
    conn IN OUT parameter that contains the connection info; to be
    passed in to subsequent commands to maintain session state.
    local_path Pathname of local directory in which to store the retrieved
    file's contents
    local_filename Name of local file in which to store retrieved file's contents
    (creates new file or overwrites existing file)
    remote_path Pathname (including file name) indicating location of remote
    file to be retrieved
    response OUT parameter; buffer for server replies.
    Return value: 0 (zero) if operation is successful; FTP error code if operation
    is not successful.
    Exceptions: May raise UTL_TCP.NETWORK_ERROR if some networking error occurs.
    May raise VALUE_ERROR if server response is ill-formed or buf is
    too small for file contents.
    May raise any of the UTL_FILE exceptions if file open, write, or
    close operations fail. See UTL_FILE documentation for additional
    details.
    FUNCTION Get( conn IN OUT NOCOPY UTL_TCP.Connection,
    local_path IN VARCHAR2,
    local_filename IN VARCHAR2,
    remote_path IN VARCHAR2,
    response OUT VARCHAR2 ) RETURN NUMBER;
    Function: Put
    Description: Stores data as a file on the remote server
    Parameters:
    conn IN OUT parameter that contains the connection info; to be
    passed in to subsequent commands to maintain session state.
    buf IN parameter; contains data to upload
    remote_path Pathname (including file name) indicating location of remote
    file to be created/overwritten
    response OUT parameter; buffer for server replies.
    Return value: 0 (zero) if operation is successful; FTP error code if operation
    is not successful.
    Exceptions: May raise UTL_TCP.NETWORK_ERROR if some networking error occurs.
    May raise VALUE_ERROR if server response is ill-formed.
    FUNCTION Put( conn IN OUT NOCOPY UTL_TCP.Connection,
    buf IN VARCHAR2,
    remote_path IN VARCHAR2,
    response OUT VARCHAR2 ) RETURN NUMBER;
    Function: Put
    Description: Uploads a local file to the remote server. Assumes an open file
    handle and does not close it.
    Parameters:
    conn IN OUT parameter that contains the connection info; to be
    passed in to subsequent commands to maintain session state.
    local_file IN OUT parameter; UTL_FILE file handle for input file. File
    is assumed to be open for reading.
    remote_path Pathname (including file name) indicating location of remote
    file to be created/overwritten.
    response OUT parameter; buffer for server replies.
    Return value: 0 (zero) if operation is successful; FTP error code if operation
    is not successful.
    Exceptions: May raise UTL_TCP.NETWORK_ERROR if some networking error occurs.
    May raise VALUE_ERROR if server response is ill-formed.
    May raise any of the UTL_FILE exceptions if file read operations
    fail. See UTL_FILE documentation for additional details.
    FUNCTION Put( conn IN OUT NOCOPY UTL_TCP.Connection,
    local_file IN OUT UTL_FILE.File_Type,
    remote_path IN VARCHAR2,
    response OUT VARCHAR2 ) RETURN NUMBER;
    Function: Put
    Description: Uploads a local file to the remote server. Opens and closes local
    file automatically.
    Parameters:
    conn IN OUT parameter that contains the connection info; to be
    passed in to subsequent commands to maintain session state.
    local_path Pathname of local directory in which file to upload exists.
    local_filename Name of local file to upload.
    remote_path Pathname (including file name) indicating location of remote
    file to be created/overwritten.
    response OUT parameter; buffer for server replies.
    Return value: 0 (zero) if operation is successful; FTP error code if operation
    is not successful.
    Exceptions: May raise UTL_TCP.NETWORK_ERROR if some networking error occurs.
    May raise VALUE_ERROR if server response is ill-formed.
    May raise any of the UTL_FILE exceptions if file open, read, or
    close operations fail. See UTL_FILE documentation for additional
    details.
    FUNCTION Put( conn IN OUT NOCOPY UTL_TCP.Connection,
    local_path IN VARCHAR2,
    local_filename IN VARCHAR2,
    remote_path IN VARCHAR2,
    response OUT VARCHAR2 ) RETURN NUMBER;
    Function: Remote_Command
    Description: Sends an arbitrary command to the server via the SITE command.
    Parameters:
    conn IN OUT parameter that contains the connection info; to be
    passed in to subsequent commands to maintain session state.
    command Command and parameter(s) to send to the server, e.g.
    'CHMOD 600 foo.txt'
    Return value: 0 (zero) if operation is successful; FTP error code if operation
    is not successful.
    Exceptions: May raise UTL_TCP.NETWORK_ERROR if some networking error occurs.
    May raise VALUE_ERROR if server response is ill-formed.
    FUNCTION Remote_Command( conn IN OUT NOCOPY UTL_TCP.Connection,
    command IN VARCHAR2 ) RETURN NUMBER;
    Function: Chdir
    Description: Changes current working directory on remote server to specified
    path.
    Parameters:
    conn IN OUT parameter that contains the connection info; to be
    passed in to subsequent commands to maintain session state.
    remote_path Path on remote server to change to.
    Return value: 0 (zero) if operation is successful; FTP error code if operation
    is not successful.
    Exceptions: May raise UTL_TCP.NETWORK_ERROR if some networking error occurs.
    May raise VALUE_ERROR if server response is ill-formed.
    FUNCTION Chdir( conn IN OUT NOCOPY UTL_TCP.Connection,
    remote_path IN VARCHAR2 ) RETURN NUMBER;
    Function: Pwd
    Description: Prints current working directory (on remote server) to debugging
    output if debugging is turned on.
    Parameters:
    conn IN OUT parameter that contains the connection info; to be
    passed in to subsequent commands to maintain session state.
    Return value: 0 (zero) if operation is successful; FTP error code if operation
    is not successful.
    Exceptions: May raise UTL_TCP.NETWORK_ERROR if some networking error occurs.
    May raise VALUE_ERROR if server response is ill-formed.
    FUNCTION Pwd( conn IN OUT NOCOPY UTL_TCP.Connection ) RETURN NUMBER;
    Function: Close_Session
    Description: Closes the TCP connection to the remote server.
    Parameters:
    conn IN OUT parameter that contains the connection info; to be
    passed in to subsequent commands to maintain session state.
    Return value: 0 (zero)
    Exceptions: None raised.
    FUNCTION Close_Session( conn IN OUT NOCOPY UTL_TCP.Connection ) RETURN NUMBER;
    Function: Close_All_Sessions
    Description: Closes all currently open TCP connections.
    Parameters: None.
    Return value: 0 (zero)
    Exceptions: None raised.
    FUNCTION Close_All_Sessions RETURN NUMBER;
    END FTP;
    CREATE OR REPLACE PACKAGE BODY FTP IS
    vDebug BOOLEAN := TRUE;
    FATAL_ERROR EXCEPTION;
    PROCEDURE Debug( msg IN VARCHAR2 ) IS
    BEGIN
    IF vDebug THEN
    DBMS_OUTPUT.Put_Line( msg );
    END IF;
    END Debug;
    FUNCTION Get_Response( conn IN OUT NOCOPY UTL_TCP.Connection,
    buf IN OUT VARCHAR2 ) RETURN NUMBER IS
    vLen NUMBER;
    vCode NUMBER;
    vResp VARCHAR2(32767);
    BEGIN
    vLen := UTL_TCP.READ_LINE( conn, vResp );
    Debug( vResp );
    -- If TO_NUMBER below fails, let the exception propagate to calling proc
    vCode := TO_NUMBER( SUBSTR( vResp, 1, 3 ) );
    vResp := SUBSTR( vResp, 4 );
    buf := buf || SUBSTR( vResp, 2 );
    IF SUBSTR( vResp, 1, 1 ) = '-' THEN
    LOOP
    vLen := UTL_TCP.READ_LINE( conn, vResp );
    Debug( vResp );
    <<Get_Code>>
    BEGIN
    vCode := TO_NUMBER( SUBSTR( vResp, 1, 3 ) );
    vResp := SUBSTR( vResp, 4 );
    IF SUBSTR( vResp, 1, 1 ) = ' ' THEN
    buf := buf || SUBSTR( vResp, 2 );
    EXIT;
    END IF;
    EXCEPTION WHEN VALUE_ERROR THEN NULL;
    END Get_Code;
    buf := buf || vResp;
    END LOOP;
    END IF;
    RETURN vCode;
    END Get_Response;
    FUNCTION Do_Command( conn IN OUT NOCOPY UTL_TCP.Connection,
    cmd IN VARCHAR2,
    response OUT VARCHAR2 ) RETURN NUMBER IS
    vResult NUMBER := 0;
    BEGIN
    vResult := UTL_TCP.WRITE_LINE( conn, cmd );
    vResult := Get_Response( conn, response );
    RETURN vResult;
    END Do_Command;
    FUNCTION Parse_Port_Number( port_string IN VARCHAR2 ) RETURN NUMBER IS
    vResult NUMBER;
    vNew_Port_String VARCHAR2(32767);
    BEGIN
    -- This stuff parses out the port number encoding from the server reply
    -- Reply is in the format xyzh1,h2,h3,h4,p1,p2xyz
    -- xyz = possible character data (server-dependent, may not exist)
    -- h1-h4 = server IP elements; ignore since we know the host already
    -- p1,p2 = port number encoding (port number = p1 * 256 + p2 )
    vNew_Port_String := TRANSLATE( port_string, '0123456789', '0000000000' );
    vNew_Port_String := SUBSTR( port_string,
    INSTR( vNew_Port_String, '0' ),
    INSTR( vNew_Port_String, '0', -1 ) -
    INSTR( vNew_Port_String, '0' ) + 1 );
    vNew_Port_String := SUBSTR( vNew_Port_String,
    INSTR( vNew_Port_String, ',', 1, 4 ) + 1 );
    vResult := 256 * TO_NUMBER( SUBSTR( vNew_Port_String,
    1,
    INSTR( vNew_Port_String, ',' ) - 1 ) );
    vResult := vResult + TO_NUMBER( SUBSTR( vNew_Port_String,
    INSTR( vNew_Port_String, ',' ) + 1 ) );
    RETURN vResult;
    -- Allow VALUE_ERROR to propagate
    END Parse_Port_Number;
    FUNCTION Open_Session( conn OUT NOCOPY UTL_TCP.Connection,
    host IN VARCHAR2,
    username IN VARCHAR2,
    password IN VARCHAR2,
    response OUT VARCHAR2,
    timeout_secs IN NUMBER DEFAULT 60 ) RETURN NUMBER IS
    vResp_Code NUMBER;
    vGarbage NUMBER; -- For calling functions when we don't care about return val
    BEGIN
    conn := UTL_TCP.OPEN_CONNECTION( host,
    21,
    tx_timeout => timeout_secs );
    vResp_Code := Get_Response( conn, response );
    IF vResp_Code = 220 THEN
    vResp_Code := Do_Command( conn, 'USER ' || username, response );
    IF vResp_Code IN ( 331, 332 ) THEN
    vResp_Code := Do_Command( conn, 'PASS ' || password, response );
    IF vResp_Code NOT IN ( 202, 230 ) THEN
    RAISE FATAL_ERROR;
    END IF;
    ELSE
    RAISE FATAL_ERROR;
    END IF;
    END IF;
    vResp_Code := Do_Command( conn, 'TYPE I', response );
    Debug( 'Logged into ' || conn.remote_host || ' at port ' || conn.remote_port );
    RETURN 0;
    EXCEPTION
    WHEN FATAL_ERROR THEN
    Debug( 'Fatal error opening session:' );
    Debug( ' Code: ' || vResp_Code );
    Debug( ' Response: ' || response );
    vGarbage := Close_Session( conn );
    RETURN vResp_Code;
    END Open_Session;
    FUNCTION Get( conn IN OUT NOCOPY UTL_TCP.Connection,
    buf OUT VARCHAR2,
    remote_path IN VARCHAR2,
    response OUT VARCHAR2 ) RETURN NUMBER IS
    vResp VARCHAR2(32767);
    vResp_Code NUMBER;
    vNew_Conn UTL_TCP.Connection;
    vNew_Port NUMBER;
    BEGIN
    -- do PASV
    vResp_Code := Do_Command( conn, 'PASV', response );
    IF vResp_Code = 227 THEN
    <<Switch_Port>>
    BEGIN
    vNew_Port := Parse_Port_Number( response );
    vNew_Conn := UTL_TCP.OPEN_CONNECTION( conn.remote_host,
    vNew_Port,
    tx_timeout => conn.tx_timeout );
    Debug( 'Data connection: ' || vNew_Conn.remote_host || ':' || vNew_Conn.remote_port );
    vResp_Code := Do_Command( conn, 'RETR ' || REPLACE( remote_path, CHR(12), CHR(0) ), response );
    IF vResp_Code <> 150 THEN
    RAISE FATAL_ERROR;
    END IF;
    <<Get_Download>>
    BEGIN
    LOOP
    vResp := vResp || UTL_TCP.GET_LINE( vNew_Conn, FALSE );
    END LOOP;
    EXCEPTION
    WHEN UTL_TCP.END_OF_INPUT THEN NULL;
    END Get_Download;
    vResp_Code := Close_Session( vNew_Conn );
    vResp_Code := Get_Response( conn, response );
    IF vResp_Code BETWEEN 400 AND 599 THEN
    RAISE FATAL_ERROR;
    END IF;
    EXCEPTION
    WHEN OTHERS THEN
    Debug( SQLERRM );
    RAISE FATAL_ERROR;
    END Switch_Port;
    ELSE
    RAISE FATAL_ERROR;
    END IF;
    vResp_Code := Close_Session( vNew_Conn );
    buf := vResp;
    RETURN 0;
    EXCEPTION
    WHEN FATAL_ERROR THEN
    Debug( 'Fatal error getting ' || remote_path || ':' );
    Debug( ' Code: ' || vResp_Code );
    Debug( ' Response: ' || response );
    vResp_Code := Close_Session( vNew_Conn );
    RETURN vResp_Code;
    WHEN OTHERS THEN
    Debug( vResp_Code || ': ' || SQLERRM );
    RETURN vResp_Code;
    END Get;
    FUNCTION Get( conn IN OUT NOCOPY UTL_TCP.Connection,
    local_file IN OUT UTL_FILE.File_Type,
    remote_path IN VARCHAR2,
    response OUT VARCHAR2 ) RETURN NUMBER IS
    vResp VARCHAR2(32767);
    vResp_Code NUMBER := -1;
    vNew_Conn UTL_TCP.Connection;
    vNew_Port NUMBER;
    BEGIN
    -- do PASV
    vResp_Code := Do_Command( conn, 'PASV', response );
    IF vResp_Code = 227 THEN
    <<Switch_Port>>
    BEGIN
    vNew_Port := Parse_Port_Number( response );
    vNew_Conn := UTL_TCP.OPEN_CONNECTION( conn.remote_host,
    vNew_Port,
    tx_timeout => conn.tx_timeout );
    Debug( 'Data connection: ' || vNew_Conn.remote_host || ':' || vNew_Conn.remote_port );
    vResp_Code := Do_Command( conn, 'RETR ' || REPLACE( remote_path, CHR(12), CHR(0) ), response );
    IF vResp_Code <> 150 THEN
    RAISE FATAL_ERROR;
    END IF;
    <<Get_Download>>
    BEGIN
    LOOP
    vResp := UTL_TCP.GET_LINE( vNew_Conn, FALSE );
    UTL_FILE.Put( local_file, vResp );
    END LOOP;
    EXCEPTION
    WHEN UTL_TCP.END_OF_INPUT THEN NULL;
    END Get_Download;
    vResp_Code := Close_Session( vNew_Conn );
    vResp_Code := Get_Response( conn, response );
    IF vResp_Code BETWEEN 400 AND 599 THEN
    RAISE FATAL_ERROR;
    END IF;
    EXCEPTION
    WHEN OTHERS THEN
    Debug( SQLERRM );
    RAISE FATAL_ERROR;
    END Switch_Port;
    ELSE
    RAISE FATAL_ERROR;
    END IF;
    vResp_Code := Close_Session( vNew_Conn );
    RETURN 0;
    EXCEPTION
    WHEN FATAL_ERROR THEN
    Debug( 'Fatal error getting ' || remote_path || ':' );
    Debug( ' Code: ' || vResp_Code );
    Debug( ' Response: ' || response );
    vResp_Code := Close_Session( vNew_Conn );
    RETURN vResp_Code;
    WHEN OTHERS THEN
    Debug( vResp_Code || ': ' || SQLERRM );
    RETURN vResp_Code;
    END Get;
    FUNCTION Get( conn IN OUT NOCOPY UTL_TCP.Connection,
    local_path IN VARCHAR2,
    local_filename IN VARCHAR2,
    remote_path IN VARCHAR2,
    response OUT VARCHAR2 ) RETURN NUMBER IS
    vFile UTL_FILE.File_Type;
    vResult NUMBER := -1;
    BEGIN
    vFile := UTL_FILE.FOPEN( local_path, local_filename, 'w' );
    vResult := Get( conn, vFile, remote_path, response );
    UTL_FILE.FCLOSE( vFile );
    RETURN vResult;
    EXCEPTION WHEN OTHERS THEN
    IF UTL_FILE.IS_OPEN( vFile ) THEN
    UTL_FILE.FCLOSE( vFile );
    END IF;
    RAISE;
    END Get;
    FUNCTION Put( conn IN OUT NOCOPY UTL_TCP.Connection,
    buf IN VARCHAR2,
    remote_path IN VARCHAR2,
    response OUT VARCHAR2 ) RETURN NUMBER IS
    vResp VARCHAR2(32767);
    vResp_Code NUMBER;
    vNew_Conn UTL_TCP.Connection;
    vNew_Port NUMBER;
    BEGIN
    -- do PASV
    vResp_Code := Do_Command( conn, 'PASV', response );
    IF vResp_Code = 227 THEN
    <<Switch_Port>>
    BEGIN
    vNew_Port := Parse_Port_Number( response );
    vNew_Conn := UTL_TCP.OPEN_CONNECTION( conn.remote_host,
    vNew_Port,
    tx_timeout => conn.tx_timeout );
    Debug( 'Data connection: ' || vNew_Conn.remote_host || ':' || vNew_Conn.remote_port );
    vResp_Code := Do_Command( conn, 'STOR ' || REPLACE( remote_path, CHR(12), CHR(0) ), response );
    IF vResp_Code <> 150 THEN
    RAISE FATAL_ERROR;
    END IF;
    vResp_Code := UTL_TCP.WRITE_TEXT( vNew_Conn, buf );
    UTL_TCP.FLUSH( vNew_Conn );
    vResp_Code := Close_Session( vNew_Conn );
    vResp_Code := Get_Response( conn, response );
    IF vResp_Code BETWEEN 400 AND 599 THEN
    RAISE FATAL_ERROR;
    END IF;
    EXCEPTION
    WHEN OTHERS THEN
    Debug( SQLERRM );
    RAISE FATAL_ERROR;
    END Switch_Port;
    ELSE
    RAISE FATAL_ERROR;
    END IF;
    vResp_Code := Close_Session( vNew_Conn );
    response := vResp;
    RETURN 0;
    EXCEPTION
    WHEN FATAL_ERROR THEN
    Debug( 'Fatal error putting ' || remote_path || ':' );
    Debug( ' Code: ' || vResp_Code );
    Debug( ' Response: ' || response );
    vResp_Code := Close_Session( vNew_Conn );
    RETURN vResp_Code;
    WHEN OTHERS THEN
    Debug( vResp_Code || ': ' || SQLERRM );
    RETURN vResp_Code;
    END Put;
    FUNCTION Put( conn IN OUT NOCOPY UTL_TCP.Connection,
    local_file IN OUT UTL_FILE.File_Type,
    remote_path IN VARCHAR2,
    response OUT VARCHAR2 ) RETURN NUMBER IS
    vResp VARCHAR2(32767);
    vResp_Code NUMBER;
    vNew_Conn UTL_TCP.Connection;
    vNew_Port NUMBER;
    vNew_Port_String VARCHAR2(32767);
    BEGIN
    -- do PASV
    vResp_Code := Do_Command( conn, 'PASV', response );
    IF vResp_Code = 227 THEN
    <<Switch_Port>>
    BEGIN
    vNew_Port := Parse_Port_Number( response );
    vNew_Conn := UTL_TCP.OPEN_CONNECTION( conn.remote_host,
    vNew_Port,
    tx_timeout => conn.tx_timeout );
    Debug( 'Data connection: ' || vNew_Conn.remote_host || ':' || vNew_Conn.remote_port );
    vResp_Code := Do_Command( conn, 'STOR ' || REPLACE( remote_path, CHR(12), CHR(0) ), response );
    IF vResp_Code <> 150 THEN
    RAISE FATAL_ERROR;
    END IF;
    <<Get_Download>>
    BEGIN
    LOOP
    UTL_FILE.Get_Line( local_file, vResp );
    vResp_Code := UTL_TCP.WRITE_LINE( vNew_Conn, vResp );
    END LOOP;
    EXCEPTION
    WHEN NO_DATA_FOUND THEN NULL;
    END Get_Download;
    vResp_Code := Close_Session( vNew_Conn );
    vResp_Code := Get_Response( conn, response );
    IF vResp_Code BETWEEN 400 AND 599 THEN
    RAISE FATAL_ERROR;
    END IF;
    EXCEPTION
    WHEN OTHERS THEN
    Debug( SQLERRM );
    RAISE FATAL_ERROR;
    END Switch_Port;
    ELSE
    RAISE FATAL_ERROR;
    END IF;
    vResp_Code := Close_Session( vNew_Conn );
    RETURN 0;
    EXCEPTION
    WHEN FATAL_ERROR THEN
    Debug( 'Fatal error putting ' || remote_path || ':' );
    Debug( ' Code: ' || vResp_Code );
    Debug( ' Response: ' || response );
    vResp_Code := Close_Session( vNew_Conn );
    RETURN vResp_Code;
    WHEN OTHERS THEN
    Debug( vResp_Code || ': ' || SQLERRM );
    RETURN vResp_Code;
    END Put;
    FUNCTION Put( conn IN OUT NOCOPY UTL_TCP.Connection,
    local_path IN VARCHAR2,
    local_filename IN VARCHAR2,
    remote_path IN VARCHAR2,
    response OUT VARCHAR2 ) RETURN NUMBER IS
    vFile UTL_FILE.File_Type;
    vResult NUMBER;
    BEGIN
    vFile := UTL_FILE.FOPEN( local_path, local_filename, 'r' );
    vResult := Put( conn, vFile, remote_path, response );
    UTL_FILE.FCLOSE( vFile );
    RETURN vResult;
    EXCEPTION WHEN OTHERS THEN
    IF UTL_FILE.IS_OPEN( vFile ) THEN
    UTL_FILE.FCLOSE( vFile );
    END IF;
    RAISE;
    END Put;
    FUNCTION Remote_Command( conn IN OUT NOCOPY UTL_TCP.Connection,
    command IN VARCHAR2 ) RETURN NUMBER IS
    vResp_Code NUMBER;
    vResponse VARCHAR2(32767);
    BEGIN
    vResp_Code := Do_Command( conn, 'SITE ' || command, vResponse );
    IF vResp_Code BETWEEN 500 AND 599 THEN
    RETURN vResp_Code;
    END IF;
    RETURN 0;
    END Remote_Command;
    FUNCTION Chdir( conn IN OUT NOCOPY UTL_TCP.Connection,
    remote_path IN VARCHAR2 ) RETURN NUMBER IS
    vResp_Code NUMBER;
    vResponse VARCHAR2(32767);
    BEGIN
    vResp_Code := Do_Command( conn, 'CWD ' || REPLACE( remote_path, CHR(12), CHR(0) ), vResponse );
    IF vResp_Code BETWEEN 500 AND 599 THEN
    RETURN vResp_Code;
    END IF;
    RETURN 0;
    END Chdir;
    FUNCTION Pwd( conn IN OUT NOCOPY UTL_TCP.Connection ) RETURN NUMBER IS
    vResp_Code NUMBER;
    vResponse VARCHAR2(32767);
    BEGIN
    vResp_Code := Do_Command( conn, 'PWD', vResponse );
    IF vResp_Code BETWEEN 500 AND 599 THEN
    RETURN vResp_Code;
    END IF;
    RETURN 0;
    END Pwd;
    FUNCTION Close_Session( conn IN OUT NOCOPY UTL_TCP.Connection ) RETURN NUMBER IS
    BEGIN
    IF conn.remote_host IS NULL THEN
    RETURN 0;
    END IF;
    Debug( 'Closing connection on ' || conn.remote_host || ':' || conn.remote_port );
    UTL_TCP.Close_Connection( conn );
    RETURN 0;
    EXCEPTION
    WHEN UTL_TCP.NETWORK_ERROR THEN RETURN 0;
    END Close_Session;
    FUNCTION Close_All_Sessions RETURN NUMBER IS
    BEGIN
    UTL_TCP.Close_All_Connections;
    RETURN 0;
    END Close_All_Sessions;
    END FTP;

    Here's another PL/SQL package that will FTP ASCII text files. It assumes that you have proper permissions on the remote host and simply want to transfer one or more text files, not perform any other miscellaneous commands.
    Also, from what I have read, in 9i UTL_FILE supports reading and writing of binary data so an FTP client could be written to transfer either ASCII or BINARY files.
    Regards,
    Russ
    CREATE OR REPLACE PACKAGE BRNC_FTP_PKG
    AS
    * PL/SQL FTP Client
    * Created by: Russ Johnson, Braun Consulting
    * www.braunconsult.com
    * OVERVIEW
    * This package uses the standard packages UTL_FILE and UTL_TCP to perform
    * client-side FTP functionality (PUT and GET) for text files as defined in
    * the World Wide Web Consortium's RFC 959 document - http://www.w3.org/Protocols/rfc959/
    * The procedures and functions in this package allow single or multiple file transfer using
    * standard TCP/IP connections.
    * LIMITATIONS
    * Currently the API is limited to transfer of ASCII text files only. This is
    * primarily because UTL_FILE only supports text I/O, but also because the original
    * design was for creating text files from data in the Oracle database, then transferring the file to a remote host.
    * Furthermore, the API does not support SSH/Secure FTP or connection through a proxy server.
    * Keep in mind that FTP passes the username/password combo in plain text over TCP/IP.
    * DB versions - 8i (8.1.x) and above. 8.0.x may work if it has the SYS.UTL_TCP package.
    * Note: Since UTL_FILE is used for the client-side I/O, this package is also limited to
    * transfer of files that exist in directories available to UTL_FILE for read/write.
    * These directories are defined by the UTL_FILE_DIR parameter in the init.ora file.
    * USAGE
    * Three functions are available for FTP - PUT, GET, and FTP_MULTIPLE. FTP_MULTIPLE takes
    * a table of records that define the files to be transferred (filename, directory, etc.).
    * That table can have 1 record or multiple records. The PUT and GET functions are included
    * for convenience to FTP one file at a time. PUT and GET return true if the file is transferred
    * successfully and false if it fails. FTP_MULTIPLE returns true if no batch-level errors occur
    * (such as an invalid host, refused connection, or invalid login information). It also takes the
    * table of file records IN and passes it back OUT. Each record contains individual error information.
    * EXAMPLE
    * Transfer multiple files - 1 GET and 2 PUT from a Windows machine to a host (assuming UNIX here).
    * Display any errors that occur.
    * DECLARE
    *      v_username      VARCHAR2(40) := 'rjohnson';
    * v_password      VARCHAR2(40) := 'password';
    * v_hostname      VARCHAR2(255) := 'ftp.oracle.com';
    * v_error_message      VARCHAR2(1000);
    * b_put           BOOLEAN;
    * t_files      BRNC_FTP_PKG.t_ftp_rec; -- Declare our table of file records
    * BEGIN
    * t_files(1).localpath           := 'd:\oracle\utl_file\outbound';
    * t_files(1).filename           := 'myfile1.txt';
    * t_files(1).remotepath           := '/home/oracle/text_files';
    * t_files(1).transfer_mode      := 'PUT';
    * t_files(2).localpath           := 'd:\oracle\utl_file\inbound';
    * t_files(2).filename           := 'incoming_file.xml';
    * t_files(2).remotepath           := '/home/oracle/xml_files';
    * t_files(2).transfer_mode      := 'GET';
    * t_files(3).localpath           := 'd:\oracle\utl_file\outbound';
    * t_files(3).filename           := 'myfile2.txt';
    * t_files(3).remotepath      := '/home';
    * t_files(3).transfer_mode      := 'PUT';
    * b_put := BRNC_FTP_PKG.FTP_MULTIPLE(v_error_message,
    * t_files,
    * v_username,
    * v_password,
    * v_hostname);
    * IF b_put = TRUE
    * THEN
    *     FOR i IN t_files.FIRST..t_files.LAST
    *     LOOP
    * IF t_files.EXISTS(i)
    * THEN
    *      DBMS_OUTPUT.PUT_LINE(t_files(i).status||' | '||
    * t_files(i).error_message||' | '||
    * to_char(t_files(i).bytes_transmitted)||' | '||
    * to_char(t_files(i).trans_start,'YYYY-MM-DD HH:MI:SS')||' | '||
    * to_char(t_files(i).trans_end,'YYYY-MM-DD HH:MI:SS'));
    * END IF;
    *      END LOOP;
    * ELSE
    *      DBMS_OUTPUT.PUT_LINE(v_error_message);
    * END IF;
    * EXCEPTION
    * WHEN OTHERS
    * THEN
    * DBMS_OUTPUT.PUT_LINE(SQLERRM);
    * END;
    * CREDITS
    * The W3C's RFC 959 that describes the FTP process.
    * http://www.w3c.org
    * Much of the PL/SQL code in this package was based on Java code written by
    * Bruce Blackshaw of Enterprise Distributed Technologies Ltd. None of that code
    * was copied, but the objects and methods greatly helped my understanding of the
    * FTP Client process.
    * http://www.enterprisedt.com
    *     VERSION HISTORY
    * 1.0 11/19/2002 Unit-tested single and multiple transfers between disparate hosts.                                    
    * Exceptions
    ctrl_exception     EXCEPTION;
    data_exception     EXCEPTION;
    * Constants - FTP valid response codes
    CONNECT_CODE     CONSTANT PLS_INTEGER := 220;
    USER_CODE          CONSTANT PLS_INTEGER := 331;
    LOGIN_CODE          CONSTANT PLS_INTEGER := 230;
    PWD_CODE          CONSTANT PLS_INTEGER := 257;
    PASV_CODE          CONSTANT PLS_INTEGER := 227;
    CWD_CODE          CONSTANT PLS_INTEGER := 250;
    TSFR_START_CODE1     CONSTANT PLS_INTEGER := 125;
    TSFR_START_CODE2     CONSTANT PLS_INTEGER := 150;
    TSFR_END_CODE     CONSTANT PLS_INTEGER := 226;
    QUIT_CODE          CONSTANT PLS_INTEGER := 221;
    SYST_CODE          CONSTANT PLS_INTEGER := 215;
    TYPE_CODE          CONSTANT PLS_INTEGER := 200;
    * FTP File record datatype
    * Elements:
    * localpath - full directory name in which the local file resides or will reside
    * Windows: 'd:\oracle\utl_file'
    * UNIX: '/home/oracle/utl_file'
    * filename - filename and extension for the file to be received or sent
    * changing the filename for the PUT or GET is currently not allowed
    * Examples: 'myfile.dat' 'myfile20021119.xml'
    * remotepath - full directory name in which the local file will be sent or the
    * remote file exists. Should be in UNIX format regardless of FTP server - '/one/two/three'
    * filetype - reserved for future use, ignored in code
    * transfer_mode - 'PUT' or 'GET'
    * status - status of the transfer. 'ERROR' or 'SUCCESS'
    * error_message - meaningful (hopefully) error message explaining the reason for failure
    * bytes_transmitted - how many bytes were sent/received
    * trans_start - date/time the transmission started
    * trans_end - date/time the transmission ended
    TYPE r_ftp_rec IS RECORD(localpath           VARCHAR2(255),
                   filename           VARCHAR2(255),
                   remotepath      VARCHAR2(255),
                   filetype           VARCHAR2(20),
                   transfer_mode      VARCHAR2(5),
                   status           VARCHAR2(40),
                   error_message      VARCHAR2(255),
                   bytes_transmitted      NUMBER,
                   trans_start     DATE,
                   trans_end          DATE);
    * FTP File Table - used to store many files for transfer
    TYPE t_ftp_rec IS TABLE of r_ftp_rec INDEX BY BINARY_INTEGER;
    * Internal convenience procedure for creating passive host IP address
    * and port number.
    PROCEDURE CREATE_PASV(p_pasv_cmd IN VARCHAR2,
                   p_pasv_host OUT VARCHAR2,
                   p_pasv_port OUT NUMBER);
    * Function used to validate FTP server responses based on the
    * code passed in p_code. Reads single or multi-line responses.
    FUNCTION VALIDATE_REPLY(p_ctrl_con      IN OUT UTL_TCP.CONNECTION,
                   p_code      IN PLS_INTEGER,
                   p_reply      OUT VARCHAR2)
         RETURN BOOLEAN;
    * Function used to validate FTP server responses based on the
    * code passed in p_code. Reads single or multi-line responses.
    * Overloaded because some responses can have 2 valid codes.
    FUNCTION VALIDATE_REPLY(p_ctrl_con      IN OUT UTL_TCP.CONNECTION,
                   p_code1      IN PLS_INTEGER,
                   p_code2     IN PLS_INTEGER,
                   p_reply      OUT VARCHAR2)
         RETURN BOOLEAN;
    * Procedure that handles the actual data transfer. Meant
    * for internal package use. Returns information about the
    * actual transfer.
    PROCEDURE TRANSFER_ASCII(u_ctrl_con IN OUT UTL_TCP.CONNECTION,
                   p_localpath IN VARCHAR2,
                   p_filename IN VARCHAR2,
                   p_pasv_host IN VARCHAR2,
                   p_pasv_port IN PLS_INTEGER,
                   p_transfer_mode IN VARCHAR2,
                   v_status OUT VARCHAR2,
                   v_error_message OUT VARCHAR2,
                   n_bytes_transmitted OUT NUMBER,
                   d_trans_start OUT DATE,
    d_trans_end OUT DATE);
    * Function to handle FTP of many files.
    * Returns TRUE if no batch-level errors occur.
    * Returns FALSE if a batch-level error occurs.
    * Parameters:
    * p_error_msg - error message for batch level errors
    * p_files - BRNC_FTP_PKG.t_ftp_rec table type. Accepts
    * list of files to be transferred (may be any combination of PUT or GET)
    * returns the table updated with transfer status, error message,
    * bytes_transmitted, transmission start date/time and transmission end
    * date/time
    * p_username - username for FTP server
    * p_password - password for FTP server
    * p_hostname - hostname or IP address of server Ex: 'ftp.oracle.com' or '127.0.0.1'
    * p_port - port number to connect on. FTP is usually on 21, but this may be overridden
    * if the server is configured differently.
    FUNCTION FTP_MULTIPLE(p_error_msg OUT VARCHAR2,
                   p_files IN OUT t_ftp_rec,
                   p_username IN VARCHAR2,
                   p_password IN VARCHAR2,
                   p_hostname IN VARCHAR2,
                   p_port IN PLS_INTEGER DEFAULT 21)
         RETURN BOOLEAN;
    * Convenience function for single-file PUT
    * Parameters:
    * p_localpath - full directory name in which the local file resides or will reside
    * Windows: 'd:\oracle\utl_file'
    * UNIX: '/home/oracle/utl_file'
    * p_filename - filename and extension for the file to be received or sent
    * changing the filename for the PUT or GET is currently not allowed
    * Examples: 'myfile.dat' 'myfile20021119.xml'
    * p_remotepath - full directory name in which the local file will be sent or the
    * remote file exists. Should be in UNIX format regardless of FTP server - '/one/two/three'
    * p_username - username for FTP server
    * p_password - password for FTP server
    * p_hostname - FTP server IP address or host name Ex: 'ftp.oracle.com' or '127.0.0.1'
    * v_status - status of the transfer. 'ERROR' or 'SUCCESS'
    * v_error_message - meaningful (hopefully) error message explaining the reason for failure
    * n_bytes_transmitted - how many bytes were sent/received
    * d_trans_start - date/time the transmission started
    * d_trans_end - date/time the transmission ended
    * p_port - port number to connect to, default is 21
    * p_filetype - always set to 'ASCII', reserved for future use, ignored in code
    FUNCTION PUT(p_localpath IN VARCHAR2,
              p_filename IN VARCHAR2,
              p_remotepath IN VARCHAR2,
              p_username IN VARCHAR2,
              p_password IN VARCHAR2,
              p_hostname IN VARCHAR2,
              v_status OUT VARCHAR2,
              v_error_message OUT VARCHAR2,
              n_bytes_transmitted OUT NUMBER,
              d_trans_start OUT DATE,
    d_trans_end OUT DATE,
              p_port     IN PLS_INTEGER DEFAULT 21,
              p_filetype IN VARCHAR2 := 'ASCII')
         RETURN BOOLEAN;
    * Convenience function for single-file GET
    * Parameters:
    * p_localpath - full directory name in which the local file resides or will reside
    * Windows: 'd:\oracle\utl_file'
    * UNIX: '/home/oracle/utl_file'
    * p_filename - filename and extension for the file to be received or sent
    * changing the filename for the PUT or GET is currently not allowed
    * Examples: 'myfile.dat' 'myfile20021119.xml'
    * p_remotepath - full directory name in which the local file will be sent or the
    * remote file exists. Should be in UNIX format regardless of FTP server - '/one/two/three'
    * p_username - username for FTP server
    * p_password - password for FTP server
    * p_hostname - FTP server IP address or host name Ex: 'ftp.oracle.com' or '127.0.0.1'
    * v_status - status of the transfer. 'ERROR' or 'SUCCESS'
    * v_error_message - meaningful (hopefully) error message explaining the reason for failure
    * n_bytes_transmitted - how many bytes were sent/received
    * d_trans_start - date/time the transmission started
    * d_trans_end - date/time the transmission ended
    * p_port - port number to connect to, default is 21
    * p_filetype - always set to 'ASCII', reserved for future use, ignored in code
    FUNCTION GET(p_localpath IN VARCHAR2,
              p_filename IN VARCHAR2,
              p_remotepath IN VARCHAR2,
              p_username IN VARCHAR2,
              p_password IN VARCHAR2,
              p_hostname IN VARCHAR2,
              v_status OUT VARCHAR2,
              v_error_message OUT VARCHAR2,
              n_bytes_transmitted OUT NUMBER,
              d_trans_start OUT DATE,
    d_trans_end OUT DATE,
              p_port     IN PLS_INTEGER DEFAULT 21,
              p_filetype IN VARCHAR2 := 'ASCII')
         RETURN BOOLEAN;
    END BRNC_FTP_PKG;
    CREATE OR REPLACE PACKAGE BODY BRNC_FTP_PKG
    AS
    ** Create the passive host IP and port number to connect to
    PROCEDURE CREATE_PASV(p_pasv_cmd IN VARCHAR2,
                   p_pasv_host OUT VARCHAR2,
                   p_pasv_port OUT NUMBER)
    IS
         v_pasv_cmd     VARCHAR2(30) := p_pasv_cmd; --Host and port to connect to for data transfer
    n_port_dec     NUMBER;
         n_port_add     NUMBER;
    BEGIN
         p_pasv_host := REPLACE(SUBSTR(v_pasv_cmd,1,INSTR(v_pasv_cmd,',',1,4)-1),',','.');
         n_port_dec := TO_NUMBER(SUBSTR(v_pasv_cmd,INSTR(v_pasv_cmd,',',1,4)+1,(INSTR(v_pasv_cmd,',',1,5)-(INSTR(v_pasv_cmd,',',1,4)+1))));
         n_port_add := TO_NUMBER(SUBSTR(v_pasv_cmd,INSTR(v_pasv_cmd,',',1,5)+1,LENGTH(v_pasv_cmd)-INSTR(v_pasv_cmd,',',1,5)));
         p_pasv_port := (n_port_dec*256) + n_port_add;
    EXCEPTION
    WHEN OTHERS
    THEN
         --DBMS_OUTPUT.PUT_LINE(SQLERRM);
         RAISE;
    END CREATE_PASV;
    ** Read a single or multi-line reply from the FTP server and validate
    ** it against the code passed in p_code.
    ** Return TRUE if reply code matches p_code, FALSE if it doesn't or error
    ** occurs
    ** Send full server response back to calling procedure
    FUNCTION VALIDATE_REPLY(p_ctrl_con      IN OUT UTL_TCP.CONNECTION,
                   p_code      IN PLS_INTEGER,
                   p_reply      OUT VARCHAR2)
    RETURN BOOLEAN
    IS
         n_code           VARCHAR2(3) := p_code;
         n_byte_count      PLS_INTEGER;
         v_msg          VARCHAR2(255);
         n_line_count     PLS_INTEGER := 0;
    BEGIN
         LOOP
         v_msg := UTL_TCP.GET_LINE(p_ctrl_con);
         n_line_count := n_line_count + 1;
         IF n_line_count = 1
         THEN
              p_reply := v_msg;
         ELSE
              p_reply := p_reply || SUBSTR(v_msg,4);
         END IF;
         EXIT WHEN INSTR(v_msg,'-',1,1) <> 4;
         END LOOP;
    IF to_number(SUBSTR(p_reply,1,3)) = n_code
         THEN
         RETURN TRUE;
         ELSE
         RETURN FALSE;
         END IF;
    EXCEPTION
    WHEN OTHERS
    THEN
    p_reply := SQLERRM;
    RETURN FALSE;
    END VALIDATE_REPLY;
    ** Reads a single or multi-line reply from the FTP server
    ** Return TRUE if reply code matches p_code1 or p_code2,
    ** FALSE if it doesn't or error occurs
    ** Send full server response back to calling procedure
    FUNCTION VALIDATE_REPLY(p_ctrl_con      IN OUT UTL_TCP.CONNECTION,
                   p_code1      IN PLS_INTEGER,
                   p_code2     IN PLS_INTEGER,
                   p_reply      OUT VARCHAR2)
    RETURN BOOLEAN
    IS
         v_code1      VARCHAR2(3) := to_char(p_code1);
         v_code2      VARCHAR2(3) := to_char(p_code2);
         v_msg          VARCHAR2(255);
         n_line_count     PLS_INTEGER := 0;
    BEGIN
         LOOP
         v_msg := UTL_TCP.GET_LINE(p_ctrl_con);
         n_line_count := n_line_count + 1;
         IF n_line_count = 1
         THEN
              p_reply := v_msg;
         ELSE
              p_reply := p_reply || SUBSTR(v_msg,4);
         END IF;
         EXIT WHEN INSTR(v_msg,'-',1,1) <> 4;
         END LOOP;
    IF to_number(SUBSTR(p_reply,1,3)) IN(v_code1,v_code2)
         THEN
         RETURN TRUE;
         ELSE
         RETURN FALSE;
         END IF;
    EXCEPTION
    WHEN OTHERS
    THEN
    p_reply := SQLERRM;
    RETURN FALSE;
    END VALIDATE_REPLY;
    ** Handles actual data transfer. Responds with status, error message, and
    ** transfer statistics.
    ** Potential errors could be with connection or file i/o
    PROCEDURE TRANSFER_ASCII(u_ctrl_con IN OUT UTL_TCP.CONNECTION,
                   p_localpath IN VARCHAR2,
                   p_filename IN VARCHAR2,
                   p_pasv_host IN VARCHAR2,
                   p_pasv_port IN PLS_INTEGER,
                   p_transfer_mode IN VARCHAR2,
                   v_status OUT VARCHAR2,
                   v_error_message OUT VARCHAR2,
                   n_bytes_transmitted OUT NUMBER,
                   d_trans_start OUT DATE,
    d_trans_end OUT DATE)
    IS
         u_data_con          UTL_TCP.CONNECTION;
         u_filehandle          UTL_FILE.FILE_TYPE;
    v_tsfr_mode          VARCHAR2(3) := p_transfer_mode;
         v_mode               VARCHAR2(1);
    v_tsfr_cmd          VARCHAR2(10);
         v_buffer          VARCHAR2(32767);
         v_localpath          VARCHAR2(255)      := p_localpath;
         v_filename          VARCHAR2(255)      := p_filename;
         v_host               VARCHAR2(20)      := p_pasv_host;
         n_port               PLS_INTEGER      := p_pasv_port;
         n_bytes               NUMBER;
         v_msg               VARCHAR2(255);
         v_reply               VARCHAR2(1000);
         v_err_status          VARCHAR2(20) := 'ERROR';
    BEGIN
         /** Initialize some of our OUT variables **/
         v_status          := 'SUCCESS';
         v_error_message          := ' ';
         n_bytes_transmitted     := 0;
         IF UPPER(v_tsfr_mode) = 'PUT'
    THEN
         v_mode      := 'r';
         v_tsfr_cmd      := 'STOR ';
         ELSIF UPPER(v_tsfr_mode) = 'GET'
         THEN
         v_mode     := 'w';
         v_tsfr_cmd := 'RETR ';
    END IF;
         /** Open data connection on Passive host and port **/
         u_data_con := UTL_TCP.OPEN_CONNECTION(v_host,n_port);
         /** Open the local file to read and transfer data **/
         u_filehandle := UTL_FILE.FOPEN(v_localpath,v_filename,v_mode);
         /** Send the STOR command to tell the server we're going to upload a file **/
         n_bytes := UTL_TCP.WRITE_LINE(u_ctrl_con,v_tsfr_cmd||v_filename);
         IF VALIDATE_REPLY(u_ctrl_con,TSFR_START_CODE1,TSFR_START_CODE2,v_reply) = FALSE
         THEN
         RAISE ctrl_exception;
         END IF;
         d_trans_start := SYSDATE;
         IF UPPER(v_tsfr_mode) = 'PUT'
         THEN
         LOOP
              BEGIN
              UTL_FILE.GET_LINE(u_filehandle,v_buffer);
              EXCEPTION
              WHEN NO_DATA_FOUND
              THEN
              EXIT;
              END;
              n_bytes := UTL_TCP.WRITE_LINE(u_data_con,v_buffer);
              n_bytes_transmitted := n_bytes_transmitted + n_bytes;
         END LOOP;
         ELSIF UPPER(v_tsfr_mode) = 'GET'
         THEN
         LOOP
              BEGIN
              v_buffer := UTL_TCP.GET_LINE(u_data_con,TRUE);
              /** Sometimes the TCP/IP buffer sends null data **/
    /** we only want to receive the actual data **/
              IF v_buffer IS NOT NULL
              THEN
              UTL_FILE.PUT_LINE(u_filehandle,v_buffer);
              n_bytes := LENGTH(v_buffer);
              n_bytes_transmitted := n_bytes_transmitted + n_bytes;
              END IF;
              EXCEPTION
              WHEN UTL_TCP.END_OF_INPUT
              THEN
              EXIT;
              END;
         END LOOP;
         END IF;
         /** Flush the buffer on the data connection **/
         --UTL_TCP.FLUSH(u_data_con);
         d_trans_end := SYSDATE;
         /** Close the file **/
         UTL_FILE.FCLOSE(u_filehandle);
         /** Close the Data Connection **/
         UTL_TCP.CLOSE_CONNECTION(u_data_con);
         /** Verify the transfer succeeded **/
         IF VALIDATE_REPLY(u_ctrl_con,TSFR_END_CODE,v_reply) = FALSE
         THEN
         RAISE ctrl_exception;
         END IF;
    EXCEPTION
    WHEN ctrl_exception
    THEN
         v_status := v_err_status;
         v_error_message := v_reply;
         IF UTL_FILE.IS_OPEN(u_filehandle)
         THEN
         UTL_FILE.FCLOSE(u_filehandle);
         END IF;
         UTL_TCP.CLOSE_CONNECTION(u_data_con);
    WHEN UTL_FILE.invalid_path
    THEN
         v_status      := v_err_status;
         v_error_message := 'Directory '||v_localpath||' is not available to UTL_FILE. Check the init.ora file for valid UTL_FILE directories.';
         UTL_TCP.CLOSE_CONNECTION(u_data_con);
    WHEN UTL_FILE.invalid_operation
    THEN
         v_status := v_err_status;
         IF UPPER(v_tsfr_mode) = 'PUT'
         THEN
         v_error_message := 'The file '||V_filename||' in the directory '||v_localpath||' could not be opened for reading.';
         ELSIF UPPER(v_tsfr_mode) = 'GET'
         THEN
         v_error_message := 'The file '||V_filename||' in the directory '||v_localpath||' could not be opened for writing.';
         END IF;     
         IF UTL_FILE.IS_OPEN(u_filehandle)
         THEN
         UTL_FILE.FCLOSE(u_filehandle);
         END IF;
         UTL_TCP.CLOSE_CONNECTION(u_data_con);
    WHEN UTL_FILE.read_error
    THEN
         v_status := v_err_status;
         v_error_message := 'The system encountered an error while trying to read '||v_filename||' in the directory '||v_localpath;
         IF UTL_FILE.IS_OPEN(u_filehandle)
         THEN
         UTL_FILE.FCLOSE(u_filehandle);
         END IF;
         UTL_TCP.CLOSE_CONNECTION(u_data_con);
    WHEN UTL_FILE.write_error
    THEN
         v_status := v_err_status;
         v_error_message := 'The system encountered an error while trying to write to '||v_filename||' in the directory '||v_localpath;
         IF UTL_FILE.IS_OPEN(u_filehandle)
         THEN
         UTL_FILE.FCLOSE(u_filehandle);
         END IF;
         UTL_TCP.CLOSE_CONNECTION(u_data_con);
    WHEN UTL_FILE.internal_error
    THEN
         v_status := v_err_status;
         v_error_message := 'The UTL_FILE package encountered an unexpected internal system error.';
         IF UTL_FILE.IS_OPEN(u_filehandle)
         THEN
         UTL_FILE.FCLOSE(u_filehandle);
         END IF;
         UTL_TCP.CLOSE_CONNECTION(u_data_con);
    WHEN OTHERS
    THEN
         v_status := v_err_status;
         v_error_message := SQLERRM;
         IF UTL_FILE.IS_OPEN(u_filehandle)
         THEN
         UTL_FILE.FCLOSE(u_filehandle);
         END IF;
         UTL_TCP.CLOSE_CONNECTION(u_data_con);
    END TRANSFER_ASCII;
    ** Handles connection to host and FTP of multiple files
    ** Files can be any combination of PUT and GET
    FUNCTION FTP_MULTIPLE(p_error_msg OUT VARCHAR2,
                   p_files IN OUT t_ftp_rec,
                   p_username IN VARCHAR2,
                   p_password IN VARCHAR2,
                   p_hostname IN VARCHAR2,
                   p_port IN PLS_INTEGER DEFAULT 21)
    RETURN BOOLEAN
    IS
         v_username           VARCHAR2(30)      := p_username;
         v_password           VARCHAR2(30)      := p_password;
         v_hostname           VARCHAR2(30)      := p_hostname;
         n_port               PLS_INTEGER      := p_port;
         u_ctrl_con          UTL_TCP.CONNECTION;
         n_byte_count          PLS_INTEGER;
         n_first_index          NUMBER;
         v_msg               VARCHAR2(250);
         v_reply               VARCHAR2(1000);
    v_pasv_host          VARCHAR2(20);
    n_pasv_port          NUMBER;
         invalid_transfer     EXCEPTION;
    BEGIN
         p_error_msg := 'FTP Successful'; --Assume the overall transfer will succeed
         /** Attempt to connect to the host machine **/
         u_ctrl_con := UTL_TCP.OPEN_CONNECTION(v_hostname,n_port);
         IF VALIDATE_REPLY(u_ctrl_con,CONNECT_CODE,v_reply) = FALSE
         THEN
         RAISE ctrl_exception;
         END IF;
         /** Send username **/
         n_byte_count := UTL_TCP.WRITE_LINE(u_ctrl_con,'USER '||v_username);
         IF VALIDATE_REPLY(u_ctrl_con,USER_CODE,v_reply) = FALSE
         THEN
         RAISE ctrl_exception;
         END IF;
         /** Send password **/
         n_byte_count := UTL_TCP.WRITE_LINE(u_ctrl_con,'PASS '||v_password);
         IF VALIDATE_REPLY(u_ctrl_con,LOGIN_CODE,v_reply) = FALSE
         THEN
         RAISE ctrl_exception;
         END IF;
         /** We should be logged in, time to transfer all files **/
         FOR i IN p_files.FIRST..p_files.LAST
    LOOP
         IF p_files.EXISTS(i)
         THEN
              BEGIN
              /** Change to the remotepath directory **/
              n_byte_count := UTL_TCP.WRITE_LINE(u_ctrl_con,'CWD '||p_files(i).remotepath);
              IF VALIDATE_REPLY(u_ctrl_con,CWD_CODE,v_reply) = FALSE
              THEN
                   RAISE ctrl_exception;
              END IF;
              /** Switch to IMAGE mode **/
              n_byte_count := UTL_TCP.WRITE_LINE(u_ctrl_con,'TYPE I');
              IF VALIDATE_REPLY(u_ctrl_con,TYPE_CODE,v_reply) = FALSE
              THEN
                   RAISE ctrl_exception;
              END IF;
              /** Get a Passive connection to use for data transfer **/
              n_byte_count := UTL_TCP.WRITE_LINE(u_ctrl_con,'PASV');
              IF VALIDATE_REPLY(u_ctrl_con,PASV_CODE,v_reply) = FALSE
              THEN
                   RAISE ctrl_exception;
              END IF;
              CREATE_PASV(SUBSTR(v_reply,INSTR(v_reply,'(',1,1)+1,INSTR(v_reply,')',1,1)-INSTR(v_reply,'(',1,1)-1),v_pasv_host,n_pasv_port);
              /** Transfer Data **/
              IF UPPER(p_files(i).transfer_mode) = 'PUT'
              THEN
                   TRANSFER_ASCII(u_ctrl_con,
                        p_files(i).localpath,
                        p_files(i).filename,
                        v_pasv_host,
                        n_pasv_port,
                        p_files(i).transfer_mode,
                        p_files(i).status,
                        p_files(i).error_message,
                        p_files(i).bytes_transmitted,
                        p_files(i).trans_start,
         p_files(i).trans_end);
              ELSIF UPPER(p_files(i).transfer_mode) = 'GET'
              THEN
                   TRANSFER_ASCII(u_ctrl_con,
                        p_files(i).localpath,
                        p_files(i).filename,
                        v_pasv_host,
                        n_pasv_port,
                        p_files(i).transfer_mode,
                        p_files(i).status,
                        p_files(i).error_message,
                        p_files(i).bytes_transmitted,
                        p_files(i).trans_start,
         p_files(i).trans_end);
              ELSE
                   RAISE invalid_transfer; -- Raise an exception here
              END IF;
              EXCEPTION
              WHEN ctrl_exception
              THEN
              p_files(i).status := 'ERROR';
              p_files(i).error_message := v_reply;
              WHEN invalid_transfer
              THEN
              p_files(i).status := 'ERROR';
              p_files(i).error_message := 'Invalid transfer method. Use PUT or GET.';
              END;
         END IF;
         END LOOP;
         /** Send QUIT command **/
         n_byte_count := UTL_TCP.WRITE_LINE(u_ctrl_con,'QUIT');
         /** Don't need to validate QUIT, just close the connection **/
         UTL_TCP.CLOSE_CONNECTION(u_ctrl_con);
         RETURN TRUE;
    EXCEPTION
    WHEN ctrl_exception
    THEN
         p_error_msg := v_reply;
         UTL_TCP.CLOSE_ALL_CONNECTIONS;
         RETURN FALSE;
    WHEN OTHERS
    THEN
         p_error_msg := SQLERRM;
         UTL_TCP.CLOSE_ALL_CONNECTIONS;
         RETURN FALSE;
    END FTP_MULTIPLE;
    ** Convenience function for single-file PUT
    ** Formats file information for FTP_MULTIPLE function and calls it.
    FUNCTION PUT(p_localpath IN VARCHAR2,
              p_filename IN VARCHAR2,
              p_remotepath IN VARCHAR2,
              p_username IN VARCHAR2,
              p_password IN VARCHAR2,
              p_hostname IN VARCHAR2,
              v_status OUT VARCHAR2,
              v_error_message OUT VARCHAR2,
              n_bytes_transmitted OUT NUMBER,
              d_trans_start OUT DATE,
    d_trans_end OUT DATE,
              p_port     IN PLS_INTEGER DEFAULT 21,
              p_filetype IN VARCHAR2 := 'ASCII')
    RETURN BOOLEAN
    IS
         t_files      t_ftp_rec;
         v_username     VARCHAR2(30)      := p_username;
         v_password     VARCHAR2(50)      := p_password;
         v_hostname     VARCHAR2(100)      := p_hostname;
         n_port          PLS_INTEGER      := p_port;
    v_err_msg     VARCHAR2(255);
         b_ftp          BOOLEAN;
    BEGIN
         t_files(1).localpath          := p_localpath;
         t_files(1).filename           := p_filename;
         t_files(1).remotepath          := p_remotepath;
         t_files(1).filetype          := p_filetype;
         t_files(1).transfer_mode     := 'PUT';
         b_ftp := FTP_MULTIPLE(v_err_msg,
                   t_files,
                   v_username,
                   v_password,
                   v_hostname,
                   n_port);
         IF b_ftp = FALSE
         THEN
         v_status := 'ERROR';
         v_error_message := v_err_msg;
         RETURN FALSE;
         ELSIF b_ftp = TRUE
         THEN
         v_status                := t_files(1).status;
         v_error_message           := t_files(1).error_message;
         n_bytes_transmitted      := t_files(1).bytes_transmitted;
         d_trans_start           := t_files(1).trans_start;
         d_trans_end           := t_files(1).trans_end;
         RETURN TRUE;
         END IF;
    EXCEPTION
    WHEN OTHERS
    THEN
         v_status      := 'ERROR';
         v_error_message := SQLERRM;
         RETURN FALSE;
         --DBMS_OUTPUT.PUT_LINE(SQLERRM);
    END PUT;
    ** Convenience function for single-file GET
    ** Formats file information for FTP_MULTIPLE function and calls it.
    FUNCTION GET(p_localpath IN VARCHAR2,
              p_filename IN VARCHAR2,
              p_remotepath IN VARCHAR2,
              p_username IN VARCHAR2,
              p_password IN VARCHAR2,
              p_hostname IN VARCHAR2,
              v_status OUT VARCHAR2,
              v_error_message OUT VARCHAR2,
              n_bytes_transmitted OUT NUMBER,
              d_trans_start OUT DATE,
    d_trans_end OUT DATE,
              p_port     IN PLS_INTEGER DEFAULT 21,
              p_filetype IN VARCHAR2 := 'ASCII')
    RETURN BOOLEAN
    IS
         t_files      t_ftp_rec;
         v_username     VARCHAR2(30)      := p_username;
         v_password     VARCHAR2(50)      := p_password;
         v_hostname     VARCHAR2(100)      := p_hostname;
         n_port          PLS_INTEGER      := p_port;
    v_err_msg     VARCHAR2(255);
         b_ftp          BOOLEAN;
    BEGIN
         t_files(1).localpath          := p_localpath;
         t_files(1).filename           := p_filename;
         t_files(1).remotepath          := p_remotepath;
         t_files(1).filetype          := p_filetype;
         t_files(1).transfer_mode     := 'GET';
         b_ftp := FTP_MULTIPLE(v_err_msg,
                   t_files,
                   v_username,
                   v_password,
                   v_hostname,
                   n_port);
         IF b_ftp = FALSE
         THEN
         v_status := 'ERROR';
         v_error_message := v_err_msg;
         RETURN FALSE;
         ELSIF b_ftp = TRUE
         THEN
         v_status           := t_files(1).status;
         v_error_message      := t_files(1).error_message;
         n_bytes_transmitted := t_files(1).bytes_transmitted;
         d_trans_start      := t_files(1).trans_start;
         d_trans_end      := t_files(1).trans_end;
         RETURN TRUE;
         END IF;
    EXCEPTION
    WHEN OTHERS
    THEN
         v_status      := 'ERROR';
         v_error_message := SQLERRM;
         RETURN FALSE;
         --DBMS_OUTPUT.PUT_LINE(SQLERRM);
    END GET;
    END BRNC_FTP_PKG;
    /

  • Mail program not working since upgrading to Leopard 10.5.6

    We have loaded the new Leopard system now twice, and both times the Mail program fails to launch from the taskbar, but stays open in the background. The program will not close, and fails to open to even try to check email. It seems other programs are working just fine, but nothing right with Mail. Anyone know if there is a fix to this?
    Thanks,
    lldowney

    Hello, and welcome to the Discussions.
    While the other poster's cited article references certain issues with 10.5.6, they are when updating a system that was already on Leopard. If, as it appears, you were Upgrading an earlier version of OSX, such as 10.4.11, then the relevant article is:
    http://support.apple.com/kb/TS2537
    Where an even earlier OSX than Tiger once generated the Mail folder, two other MessageSorting files will need to be removed, also.
    Ernie

  • Db recovery in a multiprocess environment

    Hi,
    We have a application consisting of two tomcat servers using Berkeley db and hence the application is simultaneously accessed by two or more(I have a few utilities too) processes. I run one of these instances with primary flag and othe instance and all utilities are run as secondary instances. Only primary instance opens the environment with run_recover 'true', others dont specify this flag. While shutting down the instances, I try to close all open db handles along with environment handle for that instance.
    There are following scenarios:
    A) When I am shutting down the any of the tomcats, sometimes there are few open transactions and cursors. These cause some database handle close to fail and as a result, db recovery is initiated for almost every start.
    My questions for scenario A) are:
    1. There should be some way in which I can bring down the environment and still don't need to recover. In other words, assuming my environment has open cursors and transaction(over which I don't have any control as these are user-initiated). How do I properly close it. This question can be broken down in two parts:
    a) how do i figure out or get to the open transactions and cursors.
    b) then I can either wait for some time for them to complete or I can close cursors and abort/commit the transcations.
    B) Sometimes one of these processes may crash, for ex: secondary tomcat going out of memory while some of the transactions are open. Can I somehow prevent the primary instance from being corrupted in the sense that it can still use the db?
    Thanks and Regards,
    Shishir

    Hello,
    From your description I believe that the "Architecting
    Transactional Data Store applications" section of the documentation at:
    http://www.oracle.com/technology/documentation/berkeley-db/db/ref/transapp/app.html
    will provide the information you need.
    If the application is organized as a group of related processes,
    the order in which threads of control are created must be
    controlled to serialize database environment recovery. Directly
    from the documentation:
    This architecture requires that threads of control be monitored.
    If any thread of control exits with open Berkeley DB handles,
    the application may call the DB_ENV->failchk method to detect lost
    mutexes and locks and determine if the application can continue.
    If the application does not call DB_ENV->failchk, or DB_ENV->failchk returns that the database environment can no longer be used,
    the application must behave as if there has been a system
    failure, performing recovery and creating a new database environment.
    Once these actions have been taken, other threads of control can
    be continued (as long as all existing Berkeley DB handles are
    first discarded), or restarted.
    If the application is organized as a group of unrelated processes,
    some choices for monitoring them are detailed. One solution
    (directly from the documentation) is to log a thread of
    control ID when a new Berkeley DB handle is opened. For example,
    an initial "watcher" process could run recovery on the database environment and then create a sentinel file. Any "worker" process
    wanting to use the environment would check for the sentinel file.
    If the sentinel file does not exist, the worker would fail or
    wait for the sentinel file to be created. Once the sentinel file
    exists, the worker would register its process ID with the watcher
    (via shared memory, IPC or some other registry mechanism), and
    then the worker would open its DB_ENV handles and proceed. When
    the worker finishes using the environment, it would unregister
    its process ID with the watcher. The watcher periodically checks
    to ensure that no worker has failed while using the environment.
    If a worker fails while using the environment, the watcher
    removes the sentinel file, kills all of the workers currently
    using the environment, runs recovery on the environment, and
    finally creates a new sentinel file.
    The documentation also describes the use of DB_REGISTER in this
    case and the use of a "watcher" process.
    Thanks,
    Sandra

  • Restoring Apps after restoring iPod Touch

    I recently restored my wife's iPod Touch and when I hooked it back up to her laptop iTunes kept asking me to purchase the January update. I kept telling it no seeing as we had already purchased the update along with the apps back in January. I read on the forum how it should be restored using the computer that the Touch was first synched to. This solved the problem seeing as how I was using the newest laptop to do the restore. The problem is that her original laptop is close to failing which means at some point I won't be able to restore the apps if the need arises again. Is there some way to transfer the January update files and apps over to her new computer so that next time I should be able to do a restore without having to use the original laptop?

    The iPod touch January Software Upgrade can only be synced to iPod touch from the primary iTunes library. If the user is manually managing music and video on iPod, this is the computer where they first set up the iPod or first set it up after restoring the iPod. The "iPod touch App Pack 4A93.ipa" file can be copied from the computer where you purchased it to your primary iTunes library computer, and sync the iPod from there.
    The file is located here:
    Mac OS X:
    ~/Library/iTunes/Mobile Applications
    Windows XP
    C:\Documents and Settings\[user name]\Application Data\Apple Computer\iTunes\Mobile Applications\
    Windows Vista:
    C:\Users\[user name]\AppData\Roaming\\Apple Computer\iTunes\Mobile Applications\
    Note: These locations are hidden by default in Windows. You can these locations by choosing "Show hidden files and folder" in the View tab of the Folder Options Control Panel.
    Once you have copied the "iPod touch App Pack 4A93.ipa" file to the computer with your home library, make a new folder named Mobile Applications in the correct location, and place the "iPod touch App Pack 4A93.ipa" file there. Open iTunes and sync your iPod touch.

Maybe you are looking for