FTP in PLSQL

Hi All -
I am developing a small website using APEX 4.2 which has backend database that has 10-12 tables. All these tables have to be populated on daily basis based on public data published on some website.
The question is, what are the possible ways to ftp these files into my database. I donot have access to the oracle file system to use the UNIX ftp program to copy the files into Oracle directory and then do a PLSQL API which is explained in http://www.oracle-base.com/articles/misc/ftp-from-plsql.php. Please share your thoughts.
Thanks,
-Seenu

If the file is on a web site, you would need to use HTTP to access it. If the file is on a FTP server, you would need to use FTP to access it. When you click the link to download the file, are you sent to an HTTP:// address or a FTP:// URL?
You may be able to use the UTL_COMPRESS package to unzip the ZIP file once you download it-- see, for example
http://technology.amis.nl/2010/03/13/utl_compress-gzip-and-zlib/
Personally, though, I'd find it easier to write a Java stored procedure to do that. There are way more examples and far more complete libraries for working with ZIP files in Java.
Once you've unzipped the ZIP file and extracted the file, you'll have to write code to parse the file and load the data into your table.
Of course, all this would be dramatically easier if you had access to the operating system functions on the server. Then you could simply download, unzip, and parse the file as part of an external table definition with a preprocess step doing all the heavy lifting.
Justin

Similar Messages

  • FTP via PLSQL

    Dear All
    using a procedure need to generate a txt files and stored it in a table then need to ftp it to remote pc. anyone could you please help in this regards
    thanking you
    regards
    Lakmal

    There is no built-in FTP package in Oracle that I'm aware of. You'll have to look to use other peoples implementations or move the FTP functionality out of the database.
    Here is one example based on a simple Google search: [UTL_FTP|http://sourceforge.net/projects/plsqlftp/]

  • Using FTP via PL/SQL

    Hi all,
    i have the need to implement an FTP procedure and accordingly to what i found here : http://www.oracle-base.com/articles/misc/ftp-from-plsql.php i try this code:
    DECLARE
         l_conn  UTL_TCP.connection;
         l_result  PLS_INTEGER;
    BEGIN
         l_conn := UTL_TCP.open_connection('remotehost', '21');
         dbms_output.put_line('1 '||UTL_TCP.get_line(l_conn, TRUE));
         l_result := UTL_TCP.write_line(l_conn, 'USER user');
         dbms_output.put_line('2 '||UTL_TCP.get_line(l_conn, TRUE));
         l_result := UTL_TCP.write_line(l_conn, 'PASS passord');
         dbms_output.put_line('3 '||UTL_TCP.get_line(l_conn, TRUE));
         l_result := UTL_TCP.write_line(l_conn, 'cwd /some/remote/path');
         begin
              loop
                  dbms_output.put_line('4 '||UTL_TCP.get_line(l_conn, TRUE));
              end loop;
         exception
                when UTL_TCP.END_OF_INPUT then
                  null;
        end;
         l_result := UTL_TCP.write_line(l_conn, 'bye');
         UTL_TCP.close_connection(l_conn);
    END;     in order to intercept all the returning messages ... but the loop never raise exception.
    Any suggestion?
    Thanks
    Alex

    OraclePSP wrote:
    Paul Horth wrote:
    "I NEED to do ftp in a procedure, if possible"
    What business function are you trying to satisfy?Hi Paul,
    in a higher vision the all process have to :
    - transfer files in directory and subdirectory (eg. /2012/Nov , /2012/Dec, /2013/Jan, etc)
    - "check and make" the path
    - the success or errors of the entire flow has to be reported to the user
    I know that all this can be done with os command, and i already does, but i have an apex app that manage the files i would like to export.
    Is easier to report os commands result in apex vs. reproducing the command in apex directly?
    Any suggestion is welcome and appreciated.
    AlexWithout knowing more it is difficult to say what would be the best fit to your requirements but two
    approaches spring to mind.
    One is to use Unix scripts to do the ftp and write the results to a table whcih can then be interrogated by an Apex
    report as to what the result was. When you say the Apex app manages the files you want to export, do you mean
    the user picks the files to transfer? One way of doing that would be for the Unix script to read a table to see what needs
    ftping (the app would obviously set the required data up in the table).
    The second approach might be to write a Java procedure that sits in the DB and invokes the OS commands required. This procedure
    can be invoked like a normal PL/SQL procedure stored on the DB.
    Others may have other ideas.

  • How to register a custom plsql code

    Hi
    i have wrritten a custom plsql code for my Overtime entries validation for payroll processing.
    Can any body tell me how to register it in application.
    Secondly i want to get the output file generated by report submission on my desktop.i want to know where the report output files for HR and payroll are stored so that i can get them through FTP.
    Regards

    if you want to integrate your plsql into a fast formula, please download the fast formula guide from metalink. Or ask your functional payroll consultant.
    All reports and processes in Oracle Apps are handled via concurrent programs and requests. When a concurrent request is finished, click on the output button, and depending from the filetype, your browser will take action.
    All concurrent output is also stored on the concurrent server. Ask your apps dba where she mapped the concurrent output directory. But i do not see why you should need this.

  • Help Required:How Upload Excel file Into Oracle Table Using PLSQL Procedure

    Please Help , Urgent Help Needed.
    Requirement is to Upload Excel file Into Oracle Table Using PLSQL Procedure/Package.
    Case's are :
    1. Excel File is On Users/ Client PC.
    2. Application is on Remote Server(Oracle Forms D2k).
    3. User Is Using Application Using Terminal Server LogIn.
    4. So If User Will Use to GET_FILE_NAME() function of D2K to Get Excel File , D2k Will Try to pick File from That Remote Server(Bcs User Logind from Terminal Server Option).
    5. Cannot Use Util_File Package Or Oracle Directory to Place That File on Server.
    6. we are Using Oracle 8.7
    So Need Some PL/SQL Package or Fuction/ Procedure to Upload Excel file on User's Pc to Oracle Table.
    Please Guide me wd some Code. or with Some Pl/SQL Package, or With SOme Hint. Or any Link ....
    Jus help to Sort This Issue ........
    you can also write me on :
    [email protected], [email protected]

    TEXT_IO is a PL/SQL package available only in Forms (you'll want to post in the Forms forum for more information). It is not available in a stored procedure in the database (where the equivalent package is UTL_FILE).
    If the Terminal Server machine and the database machine do not have access to the file system on the client machine, no application running on either machine will have access to the file. Barring exceptional setups (like the FTP server on the client machine), your applications are not going to have more access to the client machine than the operating system does.
    If you map the client drives from the Terminal Server box, there is the potential for your Forms application to access those files. If you want the files to be accessible to a stored procedure in the database, you'll need to move the files somewhere the database can access them.
    Justin

  • FTP to Client

    Hi All,
    I have requirement wherein I need to FTP a Zip file from Unix(Located in Unix Box) to Client system (Client System can be Windows or Other Unix Server).
    Please guide me how should this requirement be implemented.
    If Shell script has to be written, please share sample code and this shell script has to called by PLSQL. I have written a java code to run any shell commands, I assume I cn run this shell script from thejava code.
    Please suggest....

    user10542876 wrote:
    The requirement is
    Multiple user(Windows System) will login to one portal and say FTP one fil( That file is in Unix Box) to their Directory path (C:\some_folder).
    Using PLSQL is it possible to achieve this??? i.e ftp the file from server to client machine.
    If yes, what information should I expect as Input like Client IP address etc..
    Also please let me know if there are any different option available.You were already suggested to use the utl_tcp package. If you'll read the documentation on it, you'll see what inputs you need.
    http://docs.oracle.com/cd/E11882_01/appdev.112/e25788/u_tcp.htm#CEGDFJJE
    Learning how to look things up in the documentation is time well spent investing in your career. To that end, you should drop everything else you are doing and do the following:
    Go to tahiti.oracle.com.
    Drill down to your product and version.
    <b><i><u>BOOKMARK THAT LOCATION</u></i></b>
    Spend a few minutes just getting familiar with what is available here. Take special note of the "books" and "search" tabs. Under the "books" tab (for 10.x) or the "Master Book List" link (for 11.x) you will find the complete documentation library.
    Spend a few minutes just getting familiar with what <b><i><u>kind</u></i></b> of documentation is available there by simply browsing the titles under the "Books" tab.
    Open the Reference Manual and spend a few minutes looking through the table of contents to get familiar with what <b><i><u>kind</u></i></b> of information is available there.
    Do the same with the SQL Reference Manual.
    Do the same with the Utilities manual.
    Do the same with the PL/SQL Packages and Types Reference
    You don't have to read the above in depth. They are <b><i><u>reference</b></i></u> manuals. Just get familiar with <b><i><u>what</b></i></u> is there to <b><i><u>be</b></i></u> referenced. Ninety percent of the questions asked on this forum can be answered in less than 5 minutes by simply searching one of the above manuals.
    Then set yourself a plan to dig deeper.
    - Read a chapter a day from the Concepts Manual.
    - Take a look in your alert log. One of the first things listed at startup is the initialization parms with non-default values. Read up on each one of them (listed in your alert log) in the Reference Manual.
    - Take a look at your listener.ora, tnsnames.ora, and sqlnet.ora files. Go to the Network Administrators manual and read up on everything you see in those files.
    - When you have finished reading the Concepts Manual, do it again.
    Give a man a fish and he eats for a day. Teach a man to fish and he eats for a lifetime.

  • Run shell script from plsql

    You can use utl_tcp to do http posting, send email, and ftp files. Has anyone ever executed a unix shell script from plsql on a remote unix box?

    I am actually asking about running a script file on a remote machine, not on the host. A java procedure or c file extproc call could be used to call a host script file.
    A key limitation of this java procedure method is shown in the ask tom reference:
    if you can do it from sever A on the command line (outside of oracle), we can do
    it inside the database.
    Solve that problem and we'll go from there. Oracle cannot bypass the OS and do
    magical things beyond what you've set up at the OS level.
    since utl.tcp opens a tcp connection, can you open a telnet session using utl_tcp and low level command formatting? I didnt have much trouble creating a plsql based ftp client, has anyone seen a plsql based telnet client?

  • Ftp delivery

    Hi all, i'm testing variuos delivery option in my BIP 10.1.3.2.1 and now i have a problem with ftp (...)
    I've installed a free ftp server (filezilla) on my w2003 server, i can upload/download any file using both command line and browser but when i try to deliver a report i have this errror in the log files:
    [070207_035157050][oracle.apps.xdo.servlet.scheduler.XDOJob][STATEMENT] [ID:22] Delivery 0 : Start processing FTP delivery
    [070207_035157050][oracle.apps.xdo.servlet.scheduler.XDOJob][EXCEPTION] [ID:22] Unexpected exception occurred while the document delivery.
    oracle.apps.xdo.servlet.scheduler.ProcessingException: java.lang.StringIndexOutOfBoundsException: String index out of range: -1
         at oracle.apps.xdo.servlet.scheduler.XDOJob.deliver(XDOJob.java:1511)
         at oracle.apps.xdo.servlet.scheduler.XDOJob.execute(XDOJob.java:426)
         at org.quartz.core.JobRunShell.run(JobRunShell.java:195)
         at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:520)
    Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: -1
         at java.lang.String.substring(String.java:1768)
         at oracle.apps.xdo.servlet.scheduler.XDOJob.deliver(XDOJob.java:1342)
         ... 3 more
    enabled debug and xdodebug.cfg but not able to obtain more info..
    Any idea ?

    I agree , I have experienced the same  annoying error as well . If using ftp as your delivery channel  Make sure the name you have defined as your "Server Name"  is the one you are explicitly calling as your output location  in your webservice call or plsql scheduler.

  • Delete file from an FTP folder

    Hi expert,
    I wanna know if it's possible delete with abap command a file from a FTP folder.
    I mean, there is a ftp folder periodically filled with excel files. An ABAP program read this folder and the files content must be moved in a SAP Table. Aftre this, I must delete excel files with an abap command write in the same abap program.
    Thanks a lot
    Michele Garofalo

    1) read directory with fm EPS_GET_DIRECTORY_LISTING
    2) process table dir_list
    and 3) finally delete files with
    abap command:  DELETE DATASET dsn.
    hope that helps
    Andreas

  • Delete file from FTP server

    Hi All, 
    I have a requirement where I need to delete a file from the FTP server. How do I do that?
    Thanks in Advance.
    Regards
    Jaspreet

    Hi,
    refer this link,
    [ABAP solution to implement FTP transactions |http://wiki.sdn.sap.com/wiki/display/Snippets/ABAPsolutiontoimplementFTP+transactions]
    Regards,
    Vijay

  • How to ASR 9k auto backup to external FTP server

    How to take auto  running configuration backup when use commit command in asr9k  .Our asr9k sofware Version 4.0.1[Default] .I usse the commands
    ftp client password encrypted 050D121F345F4B1B4
    ftp client username cisco
    ftp client source-interface GigabitEthernet0/0/0/14
    ftp client anonymous-password cisco
    (Password information changed)
    configuration commit auto-save filename ftp://10.10.10.3/ASR9K/asr_conf
    But auto backup not happening .following errror showing after every COMMIT command.
    ( Error:Couldn't save file /ftp://10.10.10.3/ASR9k/asr_conf.
    Error:'CfgMgr' detected the 'warning' condition 'Operation is temporarily suspended.' )
    Manually I able to take Running-configuration backup through ftp int same lacation (
    ftp://10.10.10.3/ASR9K/asr_conf ) .But automatically not happening .Please help .

    I have not personally seen this issue before but you may find verifying your config helpful.
    SUMMARY STEPS
    1. configure
    2. show running-config
    3. describe hostname hostname
    4. end
    5. show sysdb trace verification shared-plane | include path
    6. show sysdb trace verification location node-id
    7. show cfgmgr trace  
    8. show configuration history commit
    9. show configuration commit changes {last | since | commit-id}
    10. show config failed startup
    11. cfs check --> Verifies the Configuration File System (CFS)
    However I did notice the following:
    Error:Couldn't save file /ftp://10.10.10.3/ASR9k/asr_conf.  Notice the preceeding '/'?
    Thanks

  • How can i do scheduled automatic backups to an ftp server in ios xr?

    Hello guys! As the title says im looking forward to automatically back up my running config on a cisco CRS-1 to an FTP server. I was only able to find this config example:
    Configuration commit auto-save filename ftp://A.B.C.D/myconfig.txt
    This allows me to save my config to an ftp server everytime i use commit on the device. Now i want to know if there's a way to automatically save my configs everyday at 00:00  and also include the date and time in the name of the file so i don't overwrite the existing files in the ftp server.
    I dont want to use any tool i just wanna know if what im asking is possible via CLI commands. I would greatly appreciate your help with this subject.
    Regards,
    David

    Not sure if this script will work on a CRS, but try this:
    archive
    log config
    logging enable
    hidekeys
    path tftp:///$h-
    write-memory
    time-period 10080
    Explaination: 
    There are two ways to save your config to your remote station:
    1.  When someone saves the config; and
    2.  At an alloted time period, expressed in 10080 (weekly for me). 

  • Error when scheduling WEBI report to FTP server

    Hi
    We are getting error "destination directory error. CrystalEnterprise.Ftp: 550 Requested action not taken" while scheduling WEBI report to FTP server.
    Any help would be appreciated
    Regards,
    Anisa

    Hi All,
    I want a run my report once by scheduling, so i provide a time interval for scheduling a report
    start date/ time : 11:38:AM 10/30/2011
    end date/time : 11:43:AM 10/30/2011
    after completion of end time....report is failed and fetching an error
    Error : Object could not be scheduled within the specified time Interval
    Any solution for resolving this error

  • Error while FTP ing BI Publisher Report

    The following Error is occured while FTPing a BI publisher report. The scheduling was running fine for the lase 1 year .But this error is occuring in production schedule of the ftp for the last 2 days.When I do the FTP by 'Run Immediately' manually it works fine.
    oracle.apps.xdo.servlet.scheduler.ProcessingException: [ID:4621] Document file to deliver not found : /u01b/obiee/OracleBI/oc4j_bi/j2ee/home/applications/xmlpserver/xmlpserver/xdo/cache/xmlp7057786.tmp
         at oracle.apps.xdo.servlet.scheduler.XDOJob.deliver(XDOJob.java:1131)
         at oracle.apps.xdo.servlet.scheduler.XDOJob.execute(XDOJob.java:478)
         at org.quartz.core.JobRunShell.run(JobRunShell.java:195)
         at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:520)

    Duplicate post.
    Error is occured while FTPing a BI publisher report
    Error is occured while FTPing a BI publisher report
    "BI Publisher" is the appropriate forum for such questions.
    Thanks,
    Hussein

  • Error while delivering a report using FTP

    Hi,
    I am facing an error when i am trying to schedule a BIP Report to a FTP location on a FTP Server.
    The error i am getting is shown below :
    java.io.IOException: STOR semd data failed.
    at oracle.apps.xdo.delivery.ftp.FTPMainConnection.closeDataConnection(Unknown Source)
    at oracle.apps.xdo.delivery.ftp.FTPClient.closeDataConnection(Unknown Source)
    at oracle.apps.xdo.delivery.ftp.FTPDeliveryRequestHandler.submitRequest(Unknown Source)
    at oracle.apps.xdo.delivery.AbstractDeliveryRequest.submit(Unknown Source)
    at oracle.apps.xdo.service.delivery.impl.DeliveryServiceImpl.deliverToFTP(DeliveryServiceImpl.java:527)
    at oracle.apps.xdo.servlet.scheduler.XDOJob.deliver(XDOJob.java:1481)
    at oracle.apps.xdo.servlet.scheduler.XDOJob.execute(XDOJob.java:496)
    at org.quartz.core.JobRunShell.run(JobRunShell.java:195)
    at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:520)
    I am able to ping the FTP host ip and access the FTP. In the BIP Admin--> Delivery ---> FTP
    I have given my FTP Server name , HOST , and the Port
    Can anybody help me in solving this error? Its a high priority requirement from the Client side.

    Can you manually, as in command line, connect to the ftp site? Is it ftp or sftp? Single or double authentication?

Maybe you are looking for