LAE

Welcome to the LAE community!  Please feel free to start a discussion in the discussion tab or join in a conversation.

Discussions

Members

Resources

Events

 View Only
  • 1.  Premature EOF trying to read header line

    Employee
    Posted 10-19-2010 09:50

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: j thomas

    I've got two nodes based on a JDBC Query to the same database.
    The first one outputs column headings if no records are returned.
    The second one does not output any column headings if no records are returned. I think this is causing the error 'Premature EOF trying to read header line' that I then encounter when trying to use output from the second JDBC Query.

    I can't see any difference between the two nodes except for the select statements. They both explicitly select column names (first thing I tried was to replace select * with a column list in the problem node). They use different tables - the first query takes some columns from several joined tables whilst the second selects all columns from a single table.

    I tried creating a static data node for the column definitions and unioning the output with a cat node as per this thread http://community.mda-data.com/showthread.php?t=159; I tried passing the output through a filter; I tried a metadata node to check there is at least one record but each time I get the Premature EOF error.

    Is there any way to force the column headings into the output or to detect there is no header line and handle it somehow without the error getting thrown?

    Thanks in advance.


  • 2.  RE: Premature EOF trying to read header line

    Employee
    Posted 10-20-2010 08:09

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: j thomas

    The difference is whether the input has any data. Both queries used SqlFieldQueryBindings to pass a parameter used in the where clause.

    The first node's input had data that returned no match and the output contained column headings. The second node's input contained no data and the output had no column headings. (Maybe no input records = no DB query to fetch column definitions?)

    So the workaround is to add a dummy record to any input which may have no rows to force the JDBC node to execute and get the column headings.

    Bit of a pain but it works. I wonder if there's an easier way to do this? (What does the 'Mandatory' parameter do?)


  • 3.  RE: Premature EOF trying to read header line

    Employee
    Posted 12-14-2010 12:59

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: rboccuzzi

    I think you said it correctly, if there is no input data, the queries never run, and therefore, there is going to be no valid output.

    The mandatory parameter isn't going to help you here. If a node is set as mandatory, and it will not get executed as a result of a bypass; when you compile the brx, BRE will complain and not let you save as BRX. Any nodes that are likely to produce side effects (such as DB Execute or generic java / python nodes) should by default be mandatory, and most others should not.

    Cheers
    Rich