Customer Portal

Best way to get a JDBC connection inside a custom transform?

Comments 1

  • Avatar
    mzatopek
    0
    Comment actions Permalink
    Within your custom transformation code you can easily get a connection with following code:

    public class MyTrans extends DataRecordTransform {
    ...
    public boolean init() {
    DBConnection bdConnection = getGraph().getConnection(parameters.getProperty("myCustomPropertyNameWithConnectionId"));
    //OR
    for (String connectionId : getGraph().getConnections()) {
    bdConnection = (DBConnection) getGraph().getConnection(connectionId);
    }
    return true;
    }


    Variable parameters is available from DataRecordTransform class and contains all custom attributes of your Reformat component:

    <Node enabled="enabled" guiName="Reformat" id="REFORMAT1" type="REFORMAT" myCustomPropertyNameWithConnectionId="connectionId">


    Martin

Please sign in to leave a comment.