How to Call SQL Loader from Java ( servlet )?

We need to call SQL Loader command from Java Servlets? Any suggestions how this can be done?
Thanks
Rahul

Probably not the best way, but you could try using JNI to call a C function which then invokes SQL Loader via system() or exec(). I haven't done this myself though...

Similar Messages

  • Calling SQL LOADER From Java Program

    Hi
    I need to invoke sql loader from inside a Java Class.
    Any Pointers in this regards will be really appreciated.
    Thanks
    Vishal

    You can create two different files which has sqlldr command defined....
    1. loader.sh
    2. loader.bat
    and in the depending on the OS execute one...
             String command = "";
             if(System.getProperty("os.name").equals("Windows 2000")){
                    //if os is windows 2000  then execute bat file
                     command =  <<bat file path>>
              }else{
                      command = <<shell path>>
              Runtime rt = Runtime.getRuntime();
              Process p = rt.exec(command);
              int i = p.exitValue();
             

  • Calling oracle SQL Loader from java program

    Hi,
    I want to insert data into oracle tables from a text files containing fixed length fields. I am using SQLLoader to achieve this. The requirement is to call the SQLLoader within the java program.
    Does anyone know how to call SQL Loader from java program?
    Thanks,
    Varsha

    Simply "exec" the sqlldr program with the parameters you need to pass to it.
    Runtime.exec (........)
    Try to pass all parameters needed including the username and password, and use the option "silent" to avoid output, and the option "log" to have a log file of the modifications that sqlldr has done to the database.

  • Calling SQL*Loader from Forms

    Hi,
    I was wondering if anyone has called SQL*Loader from Forms?
    What I am wanting to do is use Oracle Forms as the interface where you can specify a file that you can import into the database and it will use a set control file. Push the import button and SQL*Loader does the rest.
    Is using Java code to call SQL*Loader from Forms a viable option, or is there an easier way to achieve the desired outcome.
    Any ideas or guidance will be much appreciated.
    Thanks,
    Scott.

    Scott,
    In forms, there's a HOST built-in command which is supposed to execute any o/s commands.
    What you have to do is :
    1. Bult up the string exacltly in the fashion which you will run in o/s
    2. Call the HOST Built-in and pass in the string
    Here's a example :
    Declare
    lOsCmd Varchar2(1000) := Null;
    Begin
    lOsCmd := 'sqlldr user-id=userid/passwd@connectStr '
    || ' control=c:\temp\abc.ctl log=c:\temp\abc.log '
    || ' bad = c:\temp\abc.log';
    Host (lOsCmd, No_Screen);
    End;
    -- Shailender Mehta --

  • Calling Sql*Loader from oracle Form builder

    How do i call sql* loader from my forms to import the external data in different formats into my existing database?
    Specify the flexibility of sql* loader to import external data from .txt files or .xls files.
    Would be thankful if certain examples are given along with the answer.

    Hi,
    1. First you have to create seperate ctl (Control files) which maps to different file formats
    2. Using Oracle Forms,
    2a) You can use the 'HOST' command to execute the command line ie. In this case executing
    SQL*Loader script
    2b) You also have the feature in ORACLE forms to read text files and load the data into
    ORACLE db.
    This can be achieved by using TEXT_IO package which comes with ORACLE Forms.
    Hope this helps
    Ta
    Shailender

  • Calling Sql-loader from PL/SQL

    What is the command(s) to call Sql-Loader from inside a PL/SQL procedure?
    Regards,
    Ahmad.

    I don't think it is possible ...

  • How to call gnuplot command from java

    Hi there,
    In our course, we are required to develop an GUI for gnuplot. In case you don't know about gnuplot, it's a plotting program and has lots of command. We want to use java and swing, but now we don't know how to call gnuplot command from java, or how to execute a shell command(script) from java.
    By the way, since we need read in files with several columns of data and allow user to select a column, we want to use JTable. Is that reasonable?
    Thanks a lot for any suggestions!
    Jack

    Hi, there:
    Will using JTable add much overhead? I may have to use several JTables and switch among them. I can add scroll bar to or edit JTables, right?
    BTW, do you have experience about gnuplot? Can I find the command tree of gnuplot somewhere? Or do you know a better place to post question about gnuplot? unix/linux group, maybe.
    Thanks,
    Jack
    P.S. Would you guys answer my question after I use up my duke dollars? :- )

  • How to call a Applet from a servlet and vice versa...?

    Hi all
    Can anyone help me how to call a applet from a servlet and vice versa. When the applet is called it should contact the database (oracle8i) and get the data. When i submit the applet form the data in the applet should be saved in the database.
    Thanks in advance
    Kamalakannan

    Sweep is correct about requestDispatcher being another approach for inter-servlet delegation; the only issue that i recall with this approach is that it defaults the method of the destination servlet to the one it was called from...for example, calling servlet2 from within servlet1.post() resulted in the dispatcher attempting to utilize servlet2.post() - i believe that i searched for a parameterize solution to no avail :( (ended up handling the request by placing a "fake" doPost() in servlet2 that simply called servlet2.doGet())
    however, if your application is functioning correctly on your pc/webserver then the problem may be external to servlet communication (e.g. client webserver's ports not configured or blocked, missing runtime classes, etc.)
    my suggestion would be to set aside the programmatic concerns for the moment - what is the response if you open a browser on a client's machine and access the URL in question (i.e. http://clientserver:port/stefanoServlet)? If it will not respond to access in this manner then it certainly won't when your application calls for it.
    It's possible that there is a coding error but, given the info supplied, i'd start examining the environment, first. Let us know if you have any luck with the test i recommended or not (please provide abundant detail). Or, if you've found the solution then you may want to post back with a quick blub so the next person knows how to escape the trap.
    D

  • Sample code of how to execute sql loader from visual basic

    Hi,
    Can anyone please provide me with sample code of how to
    run sql loader from inside a visual basic 6.0 application with Oracle 8.1.7.3 database or please point me to documentation/tech books containing such examples?
    Thanks very much
    John

    You have to use the command shell to activate a file.bat. The Shell command has the following parameters :
    Shell(Pathname, Windows Style )
    [email protected]
    Joel P�rez

  • Calling SQL Loader in Java

    I am writing a Java application running on SUN Solaris to perform data feed from a number of csv files to ORACLE. I am to use SQL Loader to perform the loading. What I need is to kick off the SQL Loader in my code. My question is how to kick off the SQL Loader in Java.
    One of option I am thinking is using RunTime.Exec(). Is the following code workable?
    runtime.exec( "sqlldr CONTROL=foo.ctl, LOG=bar.log, USERID=scott/tiger" );
    Althernatively should I write a Oracle store procedure to call the SQL Loader and Java call the store procedure?
    Any thoughts and directions are welcome!
    Regards,

    Hi,
    Can't you achieve the same thing using this
    Class.forName("Driver");
    Connection ocon=DriverManager.getConnection("url");
    Once you have ocon then you can execute any query.
    If this is not what you want,can you explain what SQLLoader means here?
    Regards
    Vicky

  • Calling SQL packages from java

    How do I call ORACLE sql packages from java?
    We are still using Oracle 7.3. Any sample code
    would be appreciated.

    utility.processPLSQL( connRisk,
    " Begin "
    + " hvar_sum.p_load_var_summary_data("
    + " '" + dfCall.format( priceDate ) + "', "
    + " '" + promptMonth + "',"
    + daysBack + ","
    + aliasType + ","
    + "'" + connRisk.owner + "'"
    + "); "
    + " end ; ",
    "Load VaR Summary Data",
    utility.noLogMsg ) ;
    public boolean processPLSQL(
    MyConnection conn,
    String sql,
    String dataType,
    boolean createLogMessage ) {
    double startTime = conn.log.getStartTime() ;
    try {
    CallableStatement cs = conn.theConnection.prepareCall(sql);
    cs.execute() ;
    cs.close() ;
    conn.theConnection.commit();
    if ( createLogMessage ) conn.log.logTiming( dataType, startTime ) ;
    } catch ( SQLException e ) {
    conn.log.logError( "Utility.processPLSQL; SQLException Error: " + e ) ;
    System.out.println(new java.util.Date().toString() + "; User: " + conn.user
    + "; SQL: " + sql );
    return false ;
    return true ;
    }

  • Calling SQL*Loader from OCCI

    Hi All,
    I need to access SQL*Loader from C++.
    I know there is an interface for OCI to access SQL*Loader.
    I also know there is a gnu project of a c++ wrapper to the OCI-SQL*Loader interface (odpd).
    According to the OCCI documentation it is just a C++ facade of OCI (with some goodies like thread managing , etc.).
    I want to know the following:
    1. How can I operate OCI from OCCI?
    2. Are there are source samples of operating OCI from OCCI or even better operating OCI SQL*Loader interface from OCCI?
    3. Are there are any known (/unknown :-) ) problems with either OCCI access to OCI or OCI interface itself to the SQL*Loader?
    Thanks,
    Arik

    Hi,
    If you have a OCCI application and you want to interoperate with OCI, you can retrieve the underlying OCI handles from OCCI objects and write OCI code.
    e.g :-
    //with Environment env, Connection conn OCCI objects
    OCIEnv *ocienv = env->getOCIEnv();
    OCISvcCtx *ocisvc = conn->getOCISvcCtx();
    //use OCI calls
    OCIError *errhp;
    OCIHandleAlloc (ocienv, &errhp, OCI_HTYPE_ERROR,...);
    OCIHandleAlloc (ocienv, &dpctx, OCI_HTYPE_DIRPATH_CTX,..);
    err = OCIDirPathLoadStream(...);
    OCCI does not have a direct path API at present.
    Thanks.

  • How to call external files from java?

    How to call external files in java. For example how to call a *.pdf file to open in its default editor(say Acrobat), or a *.html file to open in the default browser or a *.txt file in a notepad etc..,
    In my program i have *.chm (Compiled Windows HTML Help) help file. how to open it in its default editor it?

    Jayarathina_Madharasan wrote:
    no one answered my questionHi what wrong did i do...basically insulted all the volunteers here who took the time to consider your question and try to offer you help. Other than that, you did nothing wrong.
    From JavaRanch :
    And even if an answer doesn't solve your problem, even if it should totally miss the point - the best thing to do to motivate others to continue trying to help you is showing respect and gratitude for the investment of time that was put into dealing with your issue.
    Edited by: Encephalopathic on Apr 14, 2008 10:01 AM

  • How to Call .XDO file From Java Program

    Hi,
    I have developed a report in using BI Publisher version 10.1.3.
    I created the report and it only created XDO files. If I want to call XDO file from Java program how I can do that.
    What are the APIs available to do that.
    Thanks
    -Ashutosh

    Hi,
    the JavaAPI didn't work with the xdo-Files. But you can create a proxy stub for the Web Service API of BI Publisher which uses the xdo's in the repository.
    regards
    Rainer

  • Calling SQL Loader from Forms 4.5 using HOST command in Win2000

    One of my forms calls SQL Loader 7.3 using HOST command to load a csv file onto the database(Oracle 7.3) under Windows 2000 platform.
    Only after sql loader finishes its operation the control should come to my form i.e. synchronous execution.
    As of now its running asynchronously.
    Is there any way to make it synchronous. If Not any other work arounds?
    Environment Details
    Forms [32 Bit] Version 4.5.10.6.0 (Production)
    Windows 2000 Operating System
    Oracle7 Release 7.3.2.3.2

    Forms6i running on W2000, Rdbms 8.1.7
    in Forms I added a button TEST,
    Trigger when-button-pressed : host('test.bat') ;
    in directory .......\frm I added file test.bat :
    REM ===============
    cd /d C:\........\ldr
    pause
    sqlldr parfile=test.par
    pause
    type test.log
    pause
    exit
    REM ================
    now, pressing TEST button opens DOS window, telling me what's going on, running sqlldr, finally going back to forms
    Are you using NO_PROMPT or NO_SCREEN option of HOST command ?
    Had a look at Forms 4.5 manuals, there is no mentioning of (a)synchronously operation in connection with HOST command.

Maybe you are looking for