Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2003
    Posts
    2

    Unanswered: Specifying optimizer hints in JDBC

    Hello,

    When I submit a query using jdbc, that contains an optimizer hint, it behaves as if the hint is ignored.

    I have supplied the hint as I would if I were submitting the query directly to the database, as follows:

    SELECT /*+index(S_AGREE_ITEM S_AGREE_ITEM_X1) */ itm_stat_cd, ln_num FROM s_agree_item WHERE prod_int_ID = '2-7V-109' AND doc_agree_id = ''

    The effect is the same if I use a Statement or a PreparedStatement.

    Is there any special syntax or mechanism for supplying hints via jdbc?

    This is making me crazy, if anyone can provide any clues I would really appreciate it.

    Cheers,

    Steve.

  2. #2
    Join Date
    Feb 2003
    Posts
    2

    Re: Specifying optimizer hints in JDBC

    Hello... me again....

    After MUCH investigation it turns out that JDBC (or the particular driver that I am using) prefixes the 'rowid' attribute to the list of attributes when sending a query.

    It does this immediately after the SELECT statement, thereby rendering the optimizer hint unusable! I have put the query into an Oracle stored procedure instead and the hint is used as intended.

    Hope this posting helps someone who comes across the same problem.

    Cheers,

    S.


    Originally posted by devage
    Hello,

    When I submit a query using jdbc, that contains an optimizer hint, it behaves as if the hint is ignored.

    I have supplied the hint as I would if I were submitting the query directly to the database, as follows:

    SELECT /*+index(S_AGREE_ITEM S_AGREE_ITEM_X1) */ itm_stat_cd, ln_num FROM s_agree_item WHERE prod_int_ID = '2-7V-109' AND doc_agree_id = ''

    The effect is the same if I use a Statement or a PreparedStatement.

    Is there any special syntax or mechanism for supplying hints via jdbc?

    This is making me crazy, if anyone can provide any clues I would really appreciate it.

    Cheers,

    Steve.

Posting Permissions

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