Hi Ani,

I have attached a SQLRunner program to https://issues.apache.org/jira/browse/DERBY-5690. This is a program which uses StatementReader to loop through a batch of statements, exiting if an error occurs. Hopefully this demonstrates how to use StatementReader.

Hope this helps,
-Rick

On 12/27/12 4:37 AM, aniderbian wrote:
i have got success in parsing the script using StatementReader. Now I can get each statement separately of the script file but I doubt if it serves my purpose.

My script file is
----
connect 'jdbc:derby:../../target/sample;create=false';

CREATE  TABLE app_version (
  app_version VARCHAR(45) NOT NULL ,
  script_no VARCHAR(45) DEFAULT NULL ,
  script_status VARCHAR(45) DEFAULT NULL
  );
insert into app_version values('2.0','1','SUCCESS');
-----
My purpose is to check the status of the above script whether it runs or fails . How will I achieve this using the StatementReader class. How will I execute an individual statement using IJ in java? If you would be having an handy sample code , would really help .

Thanks
--Ani
Pl Save the environment. Please don't print this email unless you really need to.





On Thu, Dec 27, 2012 at 6:16 AM, Dag Wanvik [via Apache Database] <[hidden email] </user/SendEmail.jtp?type=node&node=126093&i=0>> wrote:


    On 26.12.2012 18:54, aniderbian wrote:
    thanks for replying,  I dont see StatementFinder.java class in
    attachment. where will I get this java file?

It's part of "tools.jar": org.apache.derby.impl.tools.ij.StatementFinder

    Thanks,
    Dag


    --Ani
    Pl Save the environment. Please don't print this email unless you
    really need to.





    On Mon, Dec 24, 2012 at 8:08 PM, Rick Hillegas-3 [via Apache
    Database] <[hidden email]
    <http://user/SendEmail.jtp?type=node&node=126076&i=0>> wrote:

        On 12/23/12 7:20 PM, Dag Wanvik wrote:

        > On 18.12.2012 19:16, aniderbian wrote:
        >> Hello,
        >> I am running a windows batch  script in which I have a
        need to fire  below
        >> command
        >> *java -jar ..\db-derby-10.9.1.0-lib\lib\derbyrun.jar ij
        sql_file.txt *.
        >>
        >> Now after firing above command I want to check return exit
        status  to
        >> capture  the success/failure of it .
        >>
        >> Or if there is any alternative  way to achieve this please
        suggest.
        >>
        >> Thanks
        > As far as I know, there is no such feature, the exit code
        is that of the
        > Java VM exiting, so it would normally be 0.
        > You probably want to know the success or failure of
        individual SQL
        > statements in the script. Presently there is no feature to
        easily
        > capturing those and relaying the results back to the OS
        invocation level
        > of ij. IJ scripting is very basic.
        > If you need such status codes, you'd probably be better off
        writing a
        > small JDBC application.
        >
        > Thanks,
        > Dag
        You may be able to use the StatementReader program attached to
        https://issues.apache.org/jira/browse/DERBY-5690. This
        program parses an
        ij script into individual statements so that you can run them
        individually and track their status.

        Hope this helps,
        -Rick
        >> --
        >> View this message in context:
        
http://apache-database.10148.n7.nabble.com/Exit-value-of-ij-tool-on-command-prompr-tp125897.html
        >> Sent from the Apache Derby Developers mailing list archive
        at Nabble.com.
        >



        ------------------------------------------------------------------------
        If you reply to this email, your message will be added to the
        discussion below:
        
http://apache-database.10148.n7.nabble.com/Exit-value-of-ij-tool-on-command-prompr-tp125897p126072.html

        To unsubscribe from Exit value of ij tool on command prompr,
        click here.
        NAML
        
<http://apache-database.10148.n7.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>




    ------------------------------------------------------------------------
    View this message in context: Re: Exit value of ij tool on
    command prompr
    
<http://apache-database.10148.n7.nabble.com/Exit-value-of-ij-tool-on-command-prompr-tp125897p126076.html>


    Sent from the Apache Derby Developers mailing list archive
    <http://apache-database.10148.n7.nabble.com/Apache-Derby-Developers-f4.html>
    at Nabble.com.



    ------------------------------------------------------------------------
    If you reply to this email, your message will be added to the
    discussion below:
    
http://apache-database.10148.n7.nabble.com/Exit-value-of-ij-tool-on-command-prompr-tp125897p126081.html

    To unsubscribe from Exit value of ij tool on command prompr, click
    here.
    NAML
    
<http://apache-database.10148.n7.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>




------------------------------------------------------------------------
View this message in context: Re: Exit value of ij tool on command prompr <http://apache-database.10148.n7.nabble.com/Exit-value-of-ij-tool-on-command-prompr-tp125897p126093.html> Sent from the Apache Derby Developers mailing list archive <http://apache-database.10148.n7.nabble.com/Apache-Derby-Developers-f4.html> at Nabble.com.

Reply via email to