Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2003
    Location
    Valley City, OH
    Posts
    18

    Unanswered: Column Not Found Error

    Good Morning

    First time shopper on this board...hopefully you can help.

    In my Java application I run a query against a local SQL database
    and return a resultset. The query:

    select c.ClosedFlag,
    ai.ActionItemId,
    ai.CallPlanId,
    ai.UserId,
    ai.ActionItem,
    ai.AssignedToId,
    ai.DueDate,
    ai.Comments,
    ai.Completed,
    ai.SubmitDate
    from
    ActionItems ai,
    CallPlans c
    where
    c.CallPlanId = ai.CallPlanId
    and ai.AssignedToId not in (select AssignedToId from
    AssignedTo where AssignedTo.Name Like 'self')

    In my code I try to retrieve the value of ClosedFlag:

    int closedFlag = rs.getInt("ClosedFlag");

    This is when I get the Column Not Found error. We have narrowed down the failing line with debug statements. The query returns the
    whole ResultSet in a Query Analyzer window.

    Any ideas? Is it possible the ResultSet did not like ClosedFlag since it is from a different table than the rest of the data?

    Thanks,
    Ed

  2. #2
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1

    Re: Column Not Found Error

    Originally posted by Ed Dobias
    Good Morning

    First time shopper on this board...hopefully you can help.

    In my Java application I run a query against a local SQL database
    and return a resultset. The query:

    select c.ClosedFlag,
    ai.ActionItemId,
    ai.CallPlanId,
    ai.UserId,
    ai.ActionItem,
    ai.AssignedToId,
    ai.DueDate,
    ai.Comments,
    ai.Completed,
    ai.SubmitDate
    from
    ActionItems ai,
    CallPlans c
    where
    c.CallPlanId = ai.CallPlanId
    and ai.AssignedToId not in (select AssignedToId from
    AssignedTo where AssignedTo.Name Like 'self')

    In my code I try to retrieve the value of ClosedFlag:

    int closedFlag = rs.getInt("ClosedFlag");

    This is when I get the Column Not Found error. We have narrowed down the failing line with debug statements. The query returns the
    whole ResultSet in a Query Analyzer window.

    Any ideas? Is it possible the ResultSet did not like ClosedFlag since it is from a different table than the rest of the data?

    Thanks,
    Ed
    You don't state your platform and database details so it's difficult to be specific. However, you could try to use ResultSetMetaData.getColumnName() to see whether the column name is actually "ClosedFlag" and not "CLOSEDFLAG" or something like that. ResultSet.getInt() implementation may be case-sensitive.

    Alternatively, use column aliases in your query, like "SELECT C.CLOSEDFLAG AS CLOSEDFLAG..."; in that case you will know exactly what the column name is.

  3. #3
    Join Date
    Oct 2003
    Location
    Valley City, OH
    Posts
    18
    Hey There -

    My bad...new to Java:

    SDK -> 1.4.1.02
    Tomcat -> 4.1.29
    SQL Server -> 7.0
    ODBC for local SQL database -> 3.70.11.40

    We put more debugging statements in and found that out of the 10 requested columns from the query only 9 are in the ResultSet. So then we went on to display the 9 that were being retrieved...ClosedFlag was not in the list.

    Thanks for the help,
    Ed

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •