Trace/Debug a JDBC2 query

Hi,
How do I trace/debug a JDBC query before it gets executed by Oracle.
I have a query that works in SQL Plus, but when I try to execute it from my application, it always gives an empty resultset. (The connection works, and all other queries works).
Here is the query in Java format:
"SELECT instrument_id, code, name, " +
" latest_buy, latest_sell " +
"FROM instrument " +
"WHERE upper(name) like(upper('?%')) " +
" OR upper(code) like(upper('?%')) " +
"ORDER BY name";
I replace the question marks by using, setString in PreparedStatement.
Now I would like to view the final query before execution. How should I do that?
thanks
/Kaj
[email protected]
null

(1) You cannot replace values inside of SQL quotes. The ? in you query are literal characters.
(2) You can see how JDBC transforms your SQL with the following code snippet from the JDBC manual.
import oracle.jdbc.driver.OracleSql;
public class Foo
public static void main (String args[]) throws Exception {
show ("{call foo(?, ?)}");
show ("{? = call bar (?, ?)}");
show ("{d '1998-10-22'}");
show ("{t '16:22:34'}");
show ("{ts '1998-10-22 16:22:34'}");
public static void show (String s) throws Exception {
System.out.println (s + " => " + new OracleSql().parse (s));
} }

Similar Messages

  • ESYU: R12 - R12 Trace/Debug file을 생성하는 방법

    Purpose
    Version: 12.0
    Information in this document applies to any platform.
    R12에서 Trace와 Debug file 생성 방법을 알아본다.
    Solution
    1. Navigate Responsibility: System Administrator> Profile> System>Query
    User: Trace를 생성할 user 명을 입력
    Profile: Initialization SQL Statement - Custom
    2. User columne에 아래의 내용을 입력
    begin fnd_ctl.fnd_sess_ctl('','','TRUE','TRUE','LOG','ALTER SESSION SET EVENTS='||''''||'10046 TRACE NAME CONTEXT FOREVER,LEVEL 12'||''''); end;
    3. 입력한 내용을 저장
    FND debug messages를 생성:
    4. Navigate Responsibility: System Administrator> Profile> System>Query
    User: Debug를 생성할 user 명을 입력
    Profile: FND:%Debug%
    5. 아래 profile options 값을 user level로 set
    FND: Debug Log Enabled Yes
    FND: Debug Log Filename <empty>
    FND: Debug Log Level STATEMENT
    FND: Debug Log Mode Asynchronous with Cross-Tier Sequencing
    FND: Debug Log Module %
    6. 입력한 내용을 저장
    Example:
    7. Navigate: Payables Responsibility> Other> Request> Run> Select and Submit the Report
    (특정 Report를 실행한다)
    8. Trace 와 FND Debug messages를 disable
    9. FND Debug message를 찾기위해 아래 query를 실행
    select log_sequence, timestamp, module,message_text
    from fnd_log_messages fnd
    where trunc(timestamp) = trunc(sysdate)
    and (module like '%xla.%' or module like '%ap.%')
    and trunc(timestamp) = trunc(sysdate)
    order by timestamp;
    SELECT log_sequence, message_text,substr(module,1,100)
    FROM fnd_log_messages msg
    , fnd_log_transaction_context tcon
    WHERE msg.TRANSACTION_CONTEXT_ID = tcon.TRANSACTION_CONTEXT_ID
    AND tcon.TRANSACTION_ID= /*Give the request id of accounting program*/
    ORDER BY LOG_SEQUENCE desc
    Debugging의 활성화를 위해 아래 profile option을 사용:
    FND: Debug Log Enabled : Yes
    FND: Debug Log Level : Statement
    Debug message를 얻기 위해 아래 query 문을 사용:
    SELECT substr(module,1,70), MESSAGE_TEXT, timestamp, log_sequence
    FROM fnd_log_messages msg, fnd_log_transaction_context tcon
    WHERE msg.TRANSACTION_CONTEXT_ID = tcon.TRANSACTION_CONTEXT_ID
    AND tcon.TRANSACTION_ID = <your child request ID>
    ORDER BY LOG_SEQUENCE
    10. 아래 SQL을 이용해 trace file이 생성되는 위치를 확인, raw trace와 tkprof'd trace
    file을 upload
    select value
    from v$parameter
    where name = 'user_dump_dest';
    Reference
    Note 458371.1

  • ST05 Trace on a select query on BSEG table

    hi all,
    this is my select query on table BSEG table:
      SELECT bukrs
             belnr
             gjahr
             buzei
             KOART
             mwskz
             kostl
             lifnr
             aufnr
             werks
             ebeln
             txjcd
             projk FROM bseg
                   INTO TABLE i_bseg
                   FOR ALL ENTRIES IN i_ad_tab
                  WHERE bukrs EQ i_ad_tab-bukrs  AND
                        belnr EQ i_ad_tab-belnr  AND
                        gjahr EQ i_ad_tab-gjahr.
    when i m doing SQL trace ST05 on this query and in the detail statement showed the following query
    SELECT
      "MANDT" , "BUKRS" , "BELNR" , "GJAHR" , "PAGENO" , "TIMESTMP" ,
      "PAGELG" , "VARDATA"
    FROM
      "RFBLG"
    WHERE
      "MANDT" = ? AND  "BUKRS" = ? AND  "BELNR" = ? AND  "GJAHR" = ?
    ORDER BY
      "MANDT" , "BUKRS" , "BELNR" , "GJAHR" , "PAGENO"
    what is RFBLG table in SE11, but could not find it.
    what is RFBLG?also, the above select query giving me performance issues.. the "for all entries" clause is used as per norms...
    please suggest a solution..

    hi
    good
    The famous BSEG table is a cluster table.
    It is as was correctly stated part of the Accounting Document Segment. It is part of the Pool cluster RFBLG and lives in the package: FBAS (Financial accounting 'Basis').
    You can't read a cluster table exactly the way you read a database (old speak, transparent table).
    You can use a program to read called RFPPWF05
    Note 435694: Display BSEG item by calling FB09D (modified FB09)
    Other possiblity: Other possibility: CALL DIALOG 'RF_ZEILEN_ANZEIGE', but since this is a dialog I don't think this would work.
    In any event go to FBAS Package (development class) to see your business objects, class library and functions.
    you must use keyfields bukrs , belnr, gjahr
    (so 1st select table bkpf) to select bseg.
    or use secondary index tables:
    bsas, bsis, bsik, bsak, bsid, bsad
    Regards,
    Raj.

  • Trace/Debug not working

    I am not seeing traces in the xsengine trace log; nor am I able to effectively set breakpoints in the Web Editor and stop page processing. I'll start by defining roles and configuration, describing actions that aren't working, and then finish with 2 questions.
    ROLES AND CONFIGURATION
    According to the developer guide, the following configuration and roles need to be in place for tracing and debugging to work. This is our current role state:
    User assigned Debugger role
    To change Trace level, user assigned TraceAdmin role
    User assigned TraceViewer role, child role of Developer
    To view tracing, confirm the following configuration. This is our current config state.:
    In the xsengine.ini file, the debugger > enabled node is set to true
    In the xsengine.ini file, the httpserver > developer_mode node is set to true
    ACTIONS
    To start tracing, set the Trace level for your package, e.g., debug. Include a trace call in the code, e.g., $.trace.debug("testing debug trace"). In the Web Editor, run the xsjs file, and in the resulting browser window, click the Call Backend button. Here is where my issues begin: there is no Call Backend button, in any browser version.
    To start debugging, set breakpoints in the Web Editor by clicking the line number. A breakpoint is indicated by a red arrow on the line number. Then run the page. The page should stop processing at that point. (You can also set breakpoints in Hana Studio by running in Debug perspective, and setting a debug configuration. I tried this also, but was unable to create a desired configuration for port 443; this is a separate issue, outside the scope of this discussion.)
    QUESTIONS
    What am I missing in setting up tracing?
    What am I missing in setting up debugging?
    Thanks in advance for any guidance.
    Bill

    Krishna,
    Thank you for your response. Running breakpoints in the Hana Studio debug perspective has its own set of challenges for us. The web server is using ssl, and thus is set to port 443, rather than port 80(server instance number). I have not been able to successfully create a configuration for running xsjs scripts through Hana Studio. But I'll keep trying.
    Bill

  • Trace/Debug .aspx/.ascx/.ascx.cs ?

    Can anybody help me how to Trace/Debug .aspx/.ascx/.ascx.cs in VS IDE?
    Many thanks for your help!

    Maybe start here:
    <a href="http://msdn2.microsoft.com/en-us/library/k0k771bt(VS.80).aspx">http://msdn2.microsoft.com/en-us/library/k0k771bt(VS.80).aspx</a>
    http://www.odetocode.com/Articles/425.aspx
    Cheers,
    Corbin

  • Help understanding simple query trace with 35,000 "query subcube" events

    No matter WHAT query I issue against my cube, I'm finding thousands of query subcube events against an unexpected , I assume it's a partition.
    Even for the simplest possible query SELECT FROM <CUBE>, which for this cube would return the measure [MRN Distinct Count], a trace reveals 35,000 query subcube events against a partition (?) called "<server>.Medical Home.MedHome.Lab Orders
    With Results" which is NOT the partition that holds that [MRN Distinct Count] measure.
    I can't figure out why this object is being queried so many times for queries completely unrelated to it.  I believe this performance degradation is somewhat new...so I have been trying to think of what may have been added to the cube recently.
    I recently added KPIs and calculated sets & members that DO draw from that Lab Orders With Results object...would calculated members or KPI's cause this kind of problem? I thought that they were all pre-calculated @ processing?
    Thanks for any insight you can provide
    Here's a summary of the profiler trace on the query SELECT FROM <CUBE>
    Event Desc
    # of Events
    ObjectPath
    Duration
    Query Begin
    1
    NULL
    0
    Query Cube Begin
    1
    <server>.Medical Home.MedHome
    0
    Query Subcube Verbose
    11
    <server>.Medical Home.MedHome.Fact Dx 2
    189
    Query Dimension
    7
    <server>.Medical Home.Dim Person
    0
    Query Subcube Verbose
    35650
    <server>.Medical Home.MedHome.Lab Orders With Results
    13856
    Serialize Results Begin
    1
    <server>.Medical Home.MedHome
    0
    Serialize Results Current
    4
    <server>.Medical Home.MedHome
    0
    Query Subcube Verbose
    5
    <server>.Medical Home.MedHome.Dim Person
    0
    Serialize Results Current
    1
    <server>.Medical Home.MedHome
    0
    Serialize Results End
    1
    <server>.Medical Home.MedHome
    0
    Query Cube End
    1
    <server>.Medical Home.MedHome
    40919
    Query End
    1
    NULL
    41059
    Paul

    RedBirdRising - my cube had several dynamic calculated sets in it.  As I recall several of those sets included slices on that one particular dimension that was being queried so many times. For me it was sets that compiled populations of people
    with particular lab result values, so that lab result partition was queried thousands of times for ANY query, even simple ones like SELECT FROM [CUBE].  
    To be precise, I actually had calculated sets interacting with calculated measures - for example, one of the offending calculated sets was really this series of calculations:
    -CALC SET 1: define calculated set of diabetic patients
    -CALC MEASURE 1: define calculated measure for most recent lab test result of a particular lab test - which included a slice on the dimension I found being queried thousands of times.
    -DYNAMIC calculated set: FILTER(CALC SET1, CALC MEASURE 1 <= x)
    So as soon as I switched that dynamic set to a STATIC set my queries began executing in a reasonable amount of time and those query subcube events were no longer issued in the thousands.  I feel like i've heard that FILTER performs poorly but didn't
    know of any alternatives to achieve what we needed.
    hope this helps...I can't say I know for sure what unforseen impact(s) switching to static sets has had yet.  Dynamic seemed like the way to go but the performance hit was just too drastic.  
    Paul

  • How to trace/debug main workflow calling sub workflow.

    Guys,
    I am calling Sub workflow from MAIN workflow.
    I am able to trace till beginning of sub workflow, with the help of workflow log.
    But, is it possible to trace/debug the sub workflow as well(in single stretch).
    Please guide with t-codes & procedures(links).......
    Regrads.
    santosh.

    Hi Santosh,
    You should be able to see the technical log for the subflow as well - but perhaps that's not what you are asking.
    First, you should always be able to 'trace' your subflows by starting them directly via SWUS.  Then you will have the log to review.
    You can also set the workflow trace on via SWU9.
    Hope this helps,
    Sue

  • Debugging mode - sql query not showing up in console

    Hi,
    I have turned on the debugging mode via Admin->Server Configuration->Debug Level. Set it to debug mode.
    I restarted the server. I wanted to test if the query will show up if there was an error in the query.
    However I am not seeing any query. It complains that there is some error, but doesn't show what query string it is using.
    Anyone got any idea how I can get query to show up on console (BI Publisher web interface) as opposed to
    going and seeing the log files on the server.
    Please let me know.
    Thanks
    Girija

    Thankyou Vetsrini.
    I will try out custom log table approach.
    I see that there is a way to test pl/sql scripts via the DBMS output
    and for that we need some invoking program like SQL PLUS to get the
    log out into a file.
    However, we wanted to see if there is a way to set Pl/SQL log files
    and get PL/SQL logs when the calling program is BI Publisher.
    regards
    Girija

  • I am not able to see the trace files for SQL query

    Hello, I am using windows vista OS.
    SQL> select * from v$version;
    BANNER
    Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Prod
    PL/SQL Release 10.2.0.3.0 - Production
    CORE 10.2.0.3.0 Production
    TNS for 32-bit Windows: Version 10.2.0.3.0 - Production
    NLSRTL Version 10.2.0.3.0 - Production
    SQL>
    I enabled the trace as below
    alter system set timed_statistics=TRUE
    alter system set sql_trace=TRUE
    After this, I ran sql query from scott as below.
    select count(*) from emp;
    After this, i checked in user dump directory. The trace files are generating... But this sql code is not appearing in the trace files...
    Am i missing anything... Any help is appreciated.
    Thanks

    This may happen when the trace file is not completely closed.You may try again doing like this,
    alter session set sql_trace=true;
    select * from emp;
    alter session set sql_trace=false;After this,disconnect and exit from your session as well. This should close the file completely and you should be able to see your command in it.
    HTH
    Aman....

  • Trace / debug Cobol process

    How to trace or debug cobol process . For example : Records and enrollment - Enroll Students - Block enrollment - enrollment request i am getting the error :
    Remote program SRPCERC failed with reason : SELECT-CAR(FETCH)NO ROW RETURNED(2,-1) ENRL_RE_HDR_WRK.ENRL_REQ_RC_PB.FieldChange PCPC:479 Statement: 10
    Select returned no rows. From which table . Please help , how to debug this process .

    It seems there is a similar bug, described in the solution id #200970506.
    Anyway, you could set the trace by setting SQLTrace (e.g. to 3) in your ProcessScheduler config file.
    You could read the following discussion :
    http://peoplesoft.ittoolbox.com/groups/technical-functional/peopletools-l/tracing-cobol-programs-1499824
    Nicolas.

  • Personas: General topic: Will it be possible to trace/debug along the UI flow?

    Hi Personas experts,
    This may be a general question - as developers implement Personas UIs, there are often cases where the new UI does not work as expected, and we don't know what is actually going on along the UI flow. This is even difficult when we use a lot of scripting which causes complex UI actions such as pressing script buttons, copy/paste values among fields etc.
    Would it be possible to do kind of tracing/debugging/loging while executing UI in Personas, so that we can see which value is copied/pasted, or which button is pressed by the scripts?
    This would greatly help developers to work more efficiently. Please advise about this. Thanks.
    Br,
    Dong Zhu

    Debugging scripts isn't possible in Personas 2. This is one of the things I find most frustrating with the scripting functionality. Small scripts are fairly easy to build and debug. Large scripts are not. There are some things you can do to make it easier.
    The first rule is to build and test scripts is small pieces. Make sure each works before moving on to the next. Put each piece on a separate script button and chain them together by having a script push the button for the next piece. This makes it easy to break a long script in the middle for debugging, without having to delete the whole thing - just remove the appropriate Press step. You can merge all the scripts together once you are done, to avoid all the script buttons. Personally I generally just hide them, so that I easily debug later when something unexpected happens after go-live.
    Create temporary text fields to paste data into if you need to see the values being copied around. Combine this with the above technique to watch values as you run through the scripts.
    Debugging will get easier in Personas 3.
    Steve.

  • Debugging a SAP Query

    Hi,
    I have created a SAP query using the tcodes sq01,sq02 and sq03.
    Have added an additional field to retrieve some text and wrote the code also inside the query.
    Now i want to debugg the query.
    How do i degubb a sap query?
    Thanks in Advance,
    Regards,
    mani

    find out program name with:
    SQ01 - query - more functions - display report name
    (example : AQZZ/GRC/APPL===FI_AP_20_Q1===)
    -> search for your add. coding / field in this report and set break-points
    hope that helps
    Andreas

  • Is it possible to Trace(Debugging) JCO request from the RFC?

    hi abap gurus.
    I am calling the rfc using jco code.
    i want to trace the request, means When the jco code execute it call the rfc.i want to trace out the values coming from java program in my abap editor.
    Thanks for ur valuable replies
    lakshman.
    save a life by sending information.
    www.help2patients.wordpress.com.

    check the system calls, i mean calls stack , may be you get some hint there.
    I never checked it.check it once.
    I am surprised to see JCO questions in ABAP forum. anyway some part related to ABAP.

  • BW errors in default trace files after starting query from portal favorite

    Hi experts,
    One of the user is executing the query in BI portal. The user is assigned to proper roles in ABAP BI system.
    The user add the query to the portal favorites, but when clicking on the favorite link the user gets the below error
    Full Message Text
    A message was generated:
    ERROR
    Cannot load view "BM015A1" (data provider "DP_1": )
    com.sap.ip.bi.webapplications.dataproviders.selector.impl.Localization loaderr_view2
    DP_1
    BM015A1
    Cannot load view "BM015A1" (data provider "DP_1": )
    com.sap.ip.bi.webapplications.dataproviders.selector.impl.Localization loaderr_view2
    DP_1
    BM015A1
    Please help me to find out why the error is happening....
    thanks in advance,
    Joeri

    users created new the bookmarks

  • Driector 10.1 Mac: trace & debug VERY slow

    I am tracing and debugging a lingo script, with various
    variables etc, totalling around 2 MB of data.
    Breakpoints, debugging, stepping through scripts, etc, is
    VERY VERY slow. Up to 20-40 second wait per step or breakpoint (I
    guess for vars to format in the debugger window).
    Is Dir 11 any faster? I've been looking for a Real reason to
    upgrade...
    Thanks
    William

    1) I've had no problems with data or code for a couple of
    years now. I upgraded to v10.1 a year ago. I had to because v9 did
    not work in OSX 10.4.x
    2) This error in the data is of some new type. So my code is
    not handling the weird data correctly. Tracing is the best way, but
    way too slow.
    I have now isolated the problem; it was due to a new version
    of Filemaker Pro inserted a new "special" char in some fields. My
    code has been corrected now and runs fine in Dir 10.1.
    In Dir 11.0 there are HUNDREDS of new errors in all our Dir
    programs and projects.
    And Dir 11 is Fantastically SLOW ! Slloooooooow!
    Stupid Dir 11 - there's NO way I'm wasting time changing MANY
    programs and projects just to do Arrogant Adobe's work for them.
    Idiots. Didn't they test this stuff? How can they sell this carp?
    3) I have Javascript that already handles 3 times this much
    data, but the date is organized first into packets.
    4) Yes, we will eventually have to rewrite all 3,000 lines of
    code. And not just in this program, but in 4-5 other programs as
    well.
    We originally wrote these in Director due to the debugger and
    the fact that I am an expert in Lingo for over ten years.
    We'll stick with Dir 10.1 for a year or two, even if we have
    to use an old Mac that's never updated or whatever.
    Eventually, we'll have to ditch Adobe Director. Thank god we
    never really buried ourselves in that other Macromedia MESS, Flash.
    Macromedia & Adobe NEVER had any "authoring language"
    programmers with any real "long term, coherent" design skill, they
    are just hacky hacky hackers, forever adding new features with no
    concept of any users but themselves.
    What a mess.
    (Oh, and Batch processing in Photoshop is a laughable mess as
    well. Jeez.)

Maybe you are looking for

  • Are Apple going to release a new iMac in 2012?

    I've seen posts and heard about the fact Apple may be releasing a new iMac (Ivy Bridge/Anti-reflective display etc) this year (september/october). Is this true? I want to get one but should I wait to see if a new one comes out?

  • OMWB 10.1.0.2 Ms Access to Oracle strange migration of Indexes

    Hi I am migrating from MS Access 2000 to Oracle 10g with OMWB 10.1.0.2 . My Access source model has 123 indexes in it. 1.The Access source model is creating index for the same column of the same table and names it like ~~temp~index~name0 for some ind

  • Download option is disabled, grayed out.

    Why is my Download option to re-download a purchased item, is grayed out? It's not active. Please advice. Thank you.

  • 6280 - Printing /Viewing Contacts on my PC

    I have recently been swayed into making my first Nokia purchase and have just bought a 6280 version V03.6. I am using PC Suite V6.80.21. The 6280 is faulty and needs to go in for repairs. This means I need to temporarily use another phone until I get

  • I need help fixing my daughters ipod

    My daughter has an IPod touch 4 gen. She has dropped it several times. The screen is cracked in the lower right hand side. In the upper part of the screen there is a black part and the color is messed up. What could this be? We are replacing the scre