Any ideas how to execute a .sql file on database server from java?

Any ideas how to execute a xyz.sql file (which is fisically on
database server) from java?
thanks

Try
sqlplus "sys/oracletest as sysdba" @bpk.sql
Working locally, and having set the ORACLE_SID, you don't need to specify the SqlNet alias (@testdb).
Remember to put an exit at the end of the bpk.sql script.

Similar Messages

  • How to execute a  .sql file from a batch file

    Hi all
    I've to take backup of a database weekly twice on every wednesday & Friday @ 5pm IST. I've written a hot backup script, which works every well.
    now i want to automate the script. ie i want this script to run on wednesday & friday @ 5pm without any human interfearance ie with out actually any1 executing this script.
    i created a batch file prod.bak with the following lines
    @echo off
    set oracle_sid=testdb
    set oracle_home=d:\oracle\ora92
    sqlplus /nolog
    connect sys as sysdba/oracletest@testdb
    this batch file when eexecuted connects me to sql prompt.
    Now i want to execute my backup script bkp.sql automatically when it is connected to sql prompt.
    (i tried with these lines in the above batch file...
    call bkp.sql---it just opens the bkp.sql file in notepad & displays the script
    start bkp.sql---same as call
    connect / as sysdba/pwd@[email protected] --- does not work simply remains a the sql prompt.
    At 17:00 /Every:w,f "d:\bkp.sql"---does not work simply remains at the sql promt.)
    Can any1 let me know what should i write in the batch file that will execute the bkp.sql file automatically after it gets connected to sql prompt. M using oracle 9i.
    I'll manage he time through windows utility of scheduling task.. Let me know how to execute the .sql file from a batch file.
    Thanks
    Tripti

    Try
    sqlplus "sys/oracletest as sysdba" @bpk.sql
    Working locally, and having set the ORACLE_SID, you don't need to specify the SqlNet alias (@testdb).
    Remember to put an exit at the end of the bpk.sql script.

  • I can't open any 60p .mov files in quicktime.  Footage was shot on a JVC GY HM150 which is supposed to record in native fcp format.  Any ideas how I can open these files successfully?

    I can't open any 60p .mov files in quicktime or FCP5.  Sometimes in QT the audio plays but not the video. Footage was shot on a JVC GY HM150 which is supposed to record in native fcp format.  Any ideas how I can open these files successfully?

    Get ClipWrap2 and convert to an editable format for your version of FCP5.
    Probably DVCProHD will work
    x

  • How to execute a sql file inside a plsql file?

    It's easy to exec a plsql inside a sql. Simply
    start my_proc.plsql
    exec my_proc;
    But how to execute a sql file inside a plsql file?
    declare ...
    begin
    start my_sql.sql?
    end;
    Thanks.
    - Zac

    Doesn't work. Even though @ is different from start in this case but it just doesn't like the way sql and plsql are mixed. For example:
    DECLARE n NUMBER := 0;
    BEGIN
    select COUNT(*) INTO n from user_tab_partitions;
    DBMS_OUTPUT.put_line('Number of partitioned tables = ' || to_char(n));
    if n = 0 then
    DBMS_OUTPUT.put_line('createViewsProcs.sql');
    @createViewsProcs.sql
    else
    DBMS_OUTPUT.put_line('createPartitionViewsProcs.sql');
    @createPartitionViewsProcs.sql
    end of;
    END;
    SQL> @postimp.sql
    SQL> DECLARE n NUMBER := 0;
    2 BEGIN
    3 select COUNT(*) INTO n from user_tab_partitions;
    4
    5 DBMS_OUTPUT.put_line('Number of partitioned tables = ' || to_char(n));
    6
    7 if n = 0 then
    8 DBMS_OUTPUT.put_line('createViewsProcs.sql');
    9 @createViewsProcs.sql
    9 SET SERVEROUTPUT ON SIZE UNLIMITED;
    10 SET TERM ON;
    11 SET ECHO ON;
    12 EXEC DBMS_OUTPUT.put_line('STARTING VIEWS, PROCS, ETC, THIS MAY TAKE A FEW MINUTES');
    13 EXEC DBMS_OUTPUT.put_line(SYSTIMESTAMP());
    14
    15
    16 CREATE OR REPLACE PACKAGE db_convert AS
    17 FUNCTION ......
    32 END;
    33 /
    SET SERVEROUTPUT ON SIZE UNLIMITED;
    ERROR at line 9:
    ORA-06550: line 9, column 5:
    PL/SQL: ORA-00922: missing or invalid option
    ...

  • How to execute a .cmd file in Solaris server

    Hi all , How to execute a .cmd file in Solaris server.
    Thanks.

    Basically you should have the execution flag associated to this cmd file. Check first if this file is builded for Solaris and then you can add the "x" flag to the file permissions.
    You can too run it like this, but you should also check if this file is Solaris compatible : # sh <path/cmd file>

  • How to execute a transaction code in prod.Server from development server

    Hi Friends,
    How to execute a transaction code in prod.Server from development server,Pls give me your valuable suggestions...
    Regards,
    V.Balaji

    i have  a program in production system if i type the request and execute its sends a mail to my admin saying to transport the request to production system.....thats y??????
    just tell me ur idea.............

  • HT204382 Telestream finds the plugged in HDVR file but will not play..blank black screen no sound or picture. DivX will not download. Error report sent to Apple. Any ideas how to import / play AVI files?

    Mac suggestes downloads to open AVI files on HDVR. Telestream finds the plugged in HDVR file but will not play...blank black screen which has no sound or picture. DivX will not download, report sent to Aplle.  Any ideas how to play the files?

    Thank you, Daniel.....
    Downloaded VLC and can play, trying now to edit clip and put it into a keynote presentation. Bought Mac as got fed up with windows but still not got used to it!

  • How to execute PL/SQL file (*.sql) ?

    In SQL*plus, I use edit command to input a sample PL/SQL program into a foo.sql, but now I don't know how to execute this PL/SQL file in SQL*plus. Who can help me ?

    In sql plus, issue the following command (for purposes of this example, I am assuming that foo.sql is in the c:\temp directory.
    @c:\temp\foo.sql
    The "@" can also be written as
    start c:\temp\foo.sql

  • How to save a .csv file to database server

    Hi every body,
    I need to upload a .csv file from the client machine and save it to a directory in a database sever.
    I could do the uploading part. Can anyone tell me how to save the file?
    Another option is save the file as a CLOB in a database column. But I'm not aware of doing that too.
    Please guide me.
    Thanks in advance.
    Surangi.

    See Steve Muench's Not Yet Documented Example #85 at http://radio.weblogs.com/0118231/stories/2004/09/23/notYetDocumentedAdfSampleApplications.html#85. While this is for 10.1.3, this is still relevant for 11g. Steve's example is for uploading to a BLOB - same thing for a CLOB. Once your data is in the database, you can use the DBMS_LOB package to write the file to a directory on the database server, if you like.
    Also the Developers Guide is your friend - Chapter 9.9 in the Fusion Web User Interface Developers Guide for Oracle ADF 11g, or 19.6 in the ADF Developers Guide for Forms/4GL Developers for JDeveloper 10.1.3.

  • How to execute one sql file in unix

    Hi,
    I need to run the follwing script in a file in unix , then run the corresponding spooled file again
    SET echo OFF;
    SET sqlblanklines ON;
    SET feedback OFF;
    SET linesize 1500;
    SET trimspool ON;
    SET termout OFF;
    SET pagesize 0;
    spool updatedfix.sql;
    SELECT ' <update stmt>
    spool OFF;
    SET termout ON;
    SET echo ON;
    SET feedback ON;
    How can the above script in a file be executed in unix
    like
    ed script
    @ script
    then
    @ updatedfix.sql;
    plz help
    thanks

    I haven't got unix to hand but the principle is the same in windows batch files..
    c:\temp>type gen_update.sql
    set echo off
    set sqlblanklines on
    set feedback off
    set linesize 1500
    set trimspool on
    set termout off
    set pagesize 0
    spool updatedfix.sql
    select 'update emp set comm = -1 where comm is null;' from dual;
    select 'exit' from dual;
    spool off;
    set termout on
    set echo on
    set feedback on
    exit
    c:\temp>sqlplus user/pass@db @gen_update.sql
    SQL*Plus: Release 10.2.0.3.0 - Production on Wed May 6 12:25:10 2009
    Copyright (c) 1982, 2006, Oracle.  All Rights Reserved.
    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
    With the Partitioning, OLAP and Data Mining options
    SQL> set feedback on
    SQL> exit
    Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
    With the Partitioning, OLAP and Data Mining options
    c:\temp>sqlplus user/pass@db @updatedfix.sql
    SQL*Plus: Release 10.2.0.3.0 - Production on Wed May 6 12:25:37 2009
    Copyright (c) 1982, 2006, Oracle.  All Rights Reserved.
    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
    With the Partitioning, OLAP and Data Mining options
    10 rows updated.
    Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
    With the Partitioning, OLAP and Data Mining options
    c:\temp>Just run one after the other in the script file.

  • Had to reinstall vista on pc. won't recognise any backup files.any ideas how to extract back up files?

    I had to reinstall vista on my pc. Did a backup of everything onto an external drive using the windows backup system. Tried going into windows restore function but it says it can't find the files. If I go into the backup through windows explorer I can find the mobilesync back up files but don't know what to do with them as I don't know that much about computers etc.  I have independent back up of all my music and photos etc. so not bothered about them but would like to be able to get my podcasts back and of course my Apps!  Does anyone have any advice?
    Did wonder if I transfer my purchases to the newly loaded iTunes will this solve the Apps problem?

    If you sign in to iTunes with your apple id and then sync your phone it will transfer the content across.

  • I have a Lenovo Optical Mouse which doesn't scroll in Firefox. Any idea how to fix it? I tried the options from the tools menu and the advance config options too. Nothing worked. Please help. Thank you.

    Wheel doesn't scroll in firefox, but works fine in other browsers and windows softwares.

    Are there any special settings in the "Control Panel > Mouse" for that scroll wheel and button?

  • How can I open help file (HTML or .chm) from Java Web Start (new to JAVA)

    Hi All,
    Im trying to open the help file of my application.
    When trying to access the help file from the GUI (pressing F1 for launching the help file), I'm geting the an error, something like:
    "Can't show help URL: jar:file:C:\Documents and Settings\%USER%\Application Data\Sun\Java\Deployment\javaws\cache\http\Dlocalhost\P7001\DMwebstart\RMjar-name!/com/resources/helpFiles/MyHelpFile.html"
    It seems that the file which is packed in a jar, was downloaded to the Java Web Start cache directory:
    C:\Documents and Settings\%USER%\Application Data\Sun\Java\Deployment\javaws\cache\http\Dlocalhost\P7001\DMwebstart
    The code which is activated when launching the help file is:
    try
                ResourceBundle resourceBundle = DoubleResourceBundle.getBundle("Resource", "ResourceImpl");
                RuntimeUtil.launchFile(new File(resourceBundle.getString("help.file")));
            } catch (IOException e)
                // TODO Auto-generated catch block
                e.printStackTrace();
            }where the property "help.file" is in some property file in the resource bundle named "Resource", and looks like this :
    help.file="com/trax/docs/help/global/MyHelpFile.html"
    The function "RuntimeUtil.launchFile" knows how to launch any file in its default application, and indeed it does launches the html, when giving it an absolute path to the file on my PC, as "C:\Helpfiles\MyHelpFile.html" as such:
    RuntimeUtil.launchFile("C:\Helpfiles\MyHelpFile.html");My question is :
    The application is going to be deployed on a Customer PC. How can I access the html file from the code, with a relative path and not its absolute path on the customer pc, which I can't know?
    I found these restrictions regarding web start:
    (copied from "http://rachel.sourceforge.net/"):
    *Rule 1: Java Archives only. No loose files.* All your resources have to be packaged in Java Archives (jar) if you want to have
    them delivered to the user's machine and kept up-to-date automatically by Java Web Start.
    *Rule 2: No file paths.* You can't use absolute or relative file paths to locate your
    jars holding your resources (e.g. <code>jar:file:///c:/java/jws/.cache/resources.jar</code>).
    Absolute file paths won't work because you never know where Java Web Start
    will put your jar on the user's machine. Relative file paths won't work because Java Web Start
    mangles the names of your jars (e.g. <code>venus.jar</code> becomes <code>RMvenus.jar</code>)
    and every JNLP client implementation has the right to mangle your names
    in a different way and you, therefore, can't predict the name with
    which your jar will be rechristend and end up on the user's machine in
    the application cache.Seems complex or impossible, to perform a simple task like opening a file.
    Please advise (I'm new to Java and Web Start).
    BTW, I'm working with IntelliJ IDEA 5.0.
    Thanks,
    Zedik.
    {font:Tahoma}{size:26pt}
    {size}{font}

    the follwing method i have used to open html file ...
    so to access html file i am shipping resources folder with jar file ..
    private void openHtmlPages(String pageName) {
         String cmd[] = new String[2];
         String browser = null;
         File file = null;
         if(System.getProperty("os.name").indexOf("Linux")>-1) {
              file = new File("/usr/bin/mozilla");
              if(!file.exists() ) {
              }else     {
                   browser = "mozilla";
         }else {
              browser = "<path of iexplore>";
         cmd[0] = browser;
         File files = new File("");
         String metaData = "/resources/Help/Files/"+pageName+".html"; // folder inside jar file
         java.net.URL url = this.getClass().getResource(metaData);
         String fileName = url.getFile();
         fileName = fileName.replaceAll("file:/","");
         fileName = fileName.replaceAll("%2520"," ");
         fileName = fileName.replaceAll("%20"," ");
         fileName = fileName.replaceAll("jarfilename.jar!"," ").trim();
         cmd[1] = fileName;     
         try{
              Process p = Runtime.getRuntime().exec(cmd);
         }catch(java.io.IOException io){
                   //Ignore
    can anyone give me the solution..???
    Regards
    Ganesan S

  • I recently bought Macbook pro  and i don't how to download Mp3 from the internet browser. it's easy on PC as you how to clickright button on mouse and then chosse save link or file. any idea how to do this?

    Hi.
    I recenly bought Macbook and as I am new to Apple word I don't know anything about the OS.
    I was trying to download Mp3 from the internet today and I just could not. when I am using PC I just click the right button and save the link or file.
    Please help me. Any idea how to download MP3?

    I had been downloading from that site for many times but from PC. When I use the left button on mouse it will take me to the internet player on my PC but if I use the right button I have to choose 'save file as' and then I save it.
    But on MACbook when I use two fingers on my trackpad there is only few options like and one of them is 'save link as' but not 'save file as'

  • How to Run a .sql file from simple java class

    How to execute a .sql file consisting of Complex Queries,procedures through simple java class.
    The queries may have different delimiters,queries independant of each other.
    I am able to do with Specific De-limiter.But I need in such a way that there should not be any
    Constraints. Since My .sql may Contain different De-limiters.
    If any one can Suggest Some Solution.
    It will be Great Help.
    regards
    Anil

    Check out ibatis script runner, it' a third party library but quite handy for running sql files...
    m

Maybe you are looking for