Hitachi Vantara Pentaho Community Forums
Results 1 to 2 of 2

Thread: Javascript and PDI

  1. #1
    Join Date
    May 2011
    Posts
    1

    Default Javascript and PDI

    Hi,

    I'm very new to this and would like help/advice on running a Javascript via PDI (currently using job option) and hit :

    2011/10/19 11:36:12 - Spoon - Iniciando trabajo...
    2011/10/19 11:36:13 - javabatch - Start of job execution
    2011/10/19 11:36:13 - javabatch - ERROR (version 4.1.2.1-GA, build 14760 from 2011-01-26 13.31.23 by buildguy) : A serious error occurred during job execution:
    2011/10/19 11:36:13 - javabatch - ERROR (version 4.1.2.1-GA, build 14760 from 2011-01-26 13.31.23 by buildguy) : Couldn't find starting point in this job.
    2011/10/19 11:36:13 - javabatch - ERROR (version 4.1.2.1-GA, build 14760 from 2011-01-26 13.31.23 by buildguy) : org.pentaho.di.core.exception.KettleJobException:
    2011/10/19 11:36:13 - javabatch - ERROR (version 4.1.2.1-GA, build 14760 from 2011-01-26 13.31.23 by buildguy) : Couldn't find starting point in this job.
    2011/10/19 11:36:13 - javabatch - ERROR (version 4.1.2.1-GA, build 14760 from 2011-01-26 13.31.23 by buildguy) : org.pentaho.di.job.Job.execute(Job.java:337)
    2011/10/19 11:36:13 - javabatch - ERROR (version 4.1.2.1-GA, build 14760 from 2011-01-26 13.31.23 by buildguy) : org.pentaho.di.job.Job.run(Job.java:282)
    2011/10/19 11:36:13 - Spoon - Trabajo ha terminado.
    2011/10/19 11:36:59 - Spoon - Spoon


    Thanks for any guidence.

    Dean

    code - created as javascript

    <?xml version="1.0" encoding="UTF-8"?>
    <job-jobentries>
    <entry>
    <name>JavaScript</name>
    <description/>
    <type>EVAL</type>
    <script>&#47;** Name: IngBat1

    import java.io.*;
    import java.sql.*;


    public class IngBat1
    {

    &#47;*
    ** NOTE: Fill in connection information here.
    *&#47;
    private static String host = &quot;uk-test&quot;;
    private static String port = &quot;V77&quot;;
    private static String db = &quot;verde02&quot;;
    private static String uid = &quot;dean&quot;;
    private static String pwd = &quot;dean&quot;;
    private static String attr = &quot;&quot;;

    &#47;*
    ** The following queries will be issued in a batch.
    *&#47;
    private static String queries[] =
    {
    &quot;create table api_batch( name varchar(20), age i4 )&quot;,
    &quot;insert into api_batch values( &apos;Adam&apos;, 1 )&quot;,
    &quot;insert into api_batch values( &apos;Benjamin&apos;, 2 )&quot;,
    &quot;insert into api_batch values( &apos;Charles&apos;, 3 )&quot;,
    &quot;insert into api_batch values( &apos;David&apos;, 4 )&quot;,
    &quot;insert into api_batch values( &apos;Edward&apos;, 5 )&quot;,
    &quot;insert into api_batch values( &apos;Frank&apos;, 6 )&quot;,
    &#47;&#47; &quot;insert into garbage values( &apos;Garbage&apos;, -1 )&quot;,
    &quot;insert into api_batch values( &apos;Gregory&apos;, 7 )&quot;,
    &quot;insert into api_batch values( &apos;Harold&apos;, 8 )&quot;,
    &quot;insert into api_batch values( &apos;Irving&apos;, 9 )&quot;,
    &#47;&#47; &quot;insert into junk values( &apos;Junk&apos;, 0 )&quot;,
    &quot;insert into api_batch values( &apos;James&apos;, 10 )&quot;,
    &quot;insert into api_batch values( &apos;Kevin&apos;, 11 )&quot;,
    &quot;insert into api_batch values( &apos;Lance&apos;, 12 )&quot;,
    &quot;insert into api_batch values( &apos;Mark&apos;, 13 )&quot;,
    &quot;insert into api_batch values( &apos;Neil&apos;, 14 )&quot;,
    &quot;insert into api_batch values( &apos;Owen&apos;, 15 )&quot;,
    &quot;insert into api_batch values( &apos;Paul&apos;, 16 )&quot;,
    &quot;insert into api_batch values( &apos;Quincy&apos;, 17 )&quot;,
    &quot;insert into api_batch values( &apos;Robert&apos;, 18 )&quot;,
    &quot;insert into api_batch values( &apos;Stewart&apos;, 19 )&quot;,
    &quot;insert into api_batch values( &apos;Timothy&apos;, 20 )&quot;,
    &quot;insert into api_batch values( &apos;Ulysses&apos;, 21 )&quot;,
    &quot;insert into api_batch values( &apos;Victor&apos;, 22 )&quot;,
    &quot;insert into api_batch values( &apos;William&apos;, 23 )&quot;, &quot;insert into api_batch values( &apos;Xavier&apos;, 24 )&quot;,
    &quot;insert into api_batch values( &apos;York&apos;, 25 )&quot;, &quot;insert into api_batch values( &apos;Zachariah&apos;, 26 )&quot;
    };


    public static void
    main( String args[] )
    {
    String url = &quot;jdbc:ingres:&#47;&#47;&quot; + host + &quot;:&quot; + port + &quot;&#47;&quot; + db +
    &quot;;UID=&quot; + uid + &quot;;PWD=&quot; + pwd + attr;
    Connection conn;

    System.out.println( &quot;JDBC Batch: Connecting: &quot; + url );

    try
    {
    if ( (conn = DriverManager.getConnection( url )) == null )
    {
    System.out.println( &quot;JDBC Bool: no driver available&quot; );
    return;
    }
    }
    catch( SQLException ex )
    {
    printSQLException( ex );
    return;
    }

    try
    {
    conn.setAutoCommit( true );
    &#47;&#47; conn.batch.enabled (false);
    Statement stmt = conn.createStatement();

    for( int i = 0; i &lt; queries.length; i++ )
    stmt.addBatch( queries[i] );

    printBatchResults( stmt.executeBatch() );
    }
    catch( BatchUpdateException bex )
    {
    printBatchResults( bex.getUpdateCounts() );
    printSQLException( bex );
    }
    catch( SQLException ex )
    {
    printSQLException( ex );
    }
    finally
    {
    System.out.println( &quot;JDBC Batch: Disconnecting&quot; );
    try { conn.rollback(); } catch( SQLException ignore ) {}
    try { conn.close(); } catch( SQLException ignore ) {}
    }

    System.out.println( &quot;JDBC Batch: Done&quot; );
    }

    private static void
    printBatchResults( int results[] )
    {
    if ( results.length == 0 )
    {
    System.out.println( &quot;No batch results!&quot; );
    return;
    }

    for( int i = 0; i &lt; results.length; i++ )
    switch( results[ i ] )
    {
    case Statement.SUCCESS_NO_INFO :
    System.out.println( &quot;Batch [&quot; + i + &quot;]: NO INFO&quot; );
    break;

    case Statement.EXECUTE_FAILED :
    System.out.println( &quot;Batch [&quot; + i + &quot;]: EXECUTE FAILED&quot; );
    break;

    default :
    System.out.println( &quot;Batch [&quot; + i + &quot;]: &quot; + results[i] );
    break;
    }

    return;
    }


    private static void
    printSQLException( SQLException ex )
    {
    do
    {

    System.out.print( &quot;SQLException: &apos;&quot; );
    System.out.print( ex.getSQLState() );
    System.out.print( &quot;&apos; 0x&quot; );
    System.out.print( Integer.toHexString( ex.getErrorCode() ) );
    System.out.print( &quot; -- &quot; );
    System.out.println( ex.getMessage() );

    } while( (ex = ex.getNextException()) != null );

    return;
    }

    }

    </script>
    <parallel>N</parallel>
    <draw>Y</draw>
    <nr>0</nr>
    <xloc>146</xloc>
    <yloc>70</yloc>
    </entry>
    </job-jobentries>

  2. #2
    Join Date
    Apr 2007
    Posts
    2,010

    Default

    read the error:

    "Couldn't find starting point in this job."

    in your job add a start step, and conenct it to the javascript step.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.