Layer7 API Management

Expand all | Collapse all

API Gateway-Perform JDBC Query is not working with input parameter passed using a context variable

  • 1.  API Gateway-Perform JDBC Query is not working with input parameter passed using a context variable

    Posted Apr 10, 2017 10:02 PM

    Trying to perform JDBC Query to get the resource_owner value for an OauthToken in incoming request. Tried setting the context variable for OAuth token and pass it to a simple query to get the corresponding "resource_owner" detail.

     

    select resource_owner from oauth_token where token= "${Token}";

     

    where Token is the context variable set to ${request.http.parameter.access_token} in incoming request.

    The query is failing with error:

     

    Perform JDBC Query failed due to: Parameter index out of range (1 > number of parameters, which is 0).

    It looks like the query is not getting the value from the context variable and it is failing.

    When i hardcode the token value the query works.



  • 2.  Re: API Gateway-Perform JDBC Query is not working with input parameter passed using a context variable

    Posted Apr 10, 2017 10:04 PM

    I am using CA API Gateway version 9.2.0



  • 3.  Re: API Gateway-Perform JDBC Query is not working with input parameter passed using a context variable
    Best Answer

    Posted Apr 10, 2017 11:24 PM

    Problem was with the query parameter (context variable) passed under quotes. It worked after removing the quotes and executing the query.