Results 1 to 10 of 10
  1. #1
    ksatty is offline Member
    Join Date
    Jan 2010
    Posts
    13
    Rep Power
    0

    Default Plsql cursor jdbc

    Hi
    I am working on unit testing ,
    I have one issue I have to check that programmer is used cursor or not and also all the cursor that he have used
    I have to use jdbc code for.
    pls help me as soon as possible

  2. #2
    ksatty is offline Member
    Join Date
    Jan 2010
    Posts
    13
    Rep Power
    0

    Default

    Thx in advance

  3. #3
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    8

    Default

    You can query v$sesstat where name='opened cursors current'.

  4. #4
    ksatty is offline Member
    Join Date
    Jan 2010
    Posts
    13
    Rep Power
    0

    Default

    Thx
    I am new to this. pls give me some sample code ?

  5. #5
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    8

    Default

    What code did you try that failed?

  6. #6
    ksatty is offline Member
    Join Date
    Jan 2010
    Posts
    13
    Rep Power
    0

    Default

    If I excute above query it is showing


    ERROR at line 1:
    ORA-00942: table or view does not exist

  7. #7
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    8

    Default

    You need to be SYS to access those views in the system tablespace.
    You should look those up in your oracle documentation. It has nothing to do with Java.

  8. #8
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,039
    Rep Power
    20

    Default

    If you're planning on trying to check all the cursors have been closed, you won't succeed. Oracle caches some, so you won't be able to tell if there's a leak that way, as far as I know...

  9. #9
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    8

    Default

    That's why I didn't suggest that they look in v$open_cursor instead.

    They could tell about the leak using these methods if they are very clever and rigorous but the attitude they have shown so far suggests that they will not.

    If you want to try it yourself see

    Monitoring Open and Cached Cursors | Oracle FAQ

  10. #10
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,039
    Rep Power
    20

    Default

    Good article, but it does (sort of) agree with what I said about it being not really doable (at least as an automated thing). I did, however, get my terminology wrong. I thought it was down to the cacheing, but it's simply down to Oracle not closing cursors straight away.

    I say automated, since they're talking about unit testing...and I would lay odds on that being JUnit. This is a hands on check and, arguably, doesn't lend itself to the sorts of things JUnit handles.

Similar Threads

  1. change the mouse cursor - crosshair cursor
    By cassysumandak in forum New To Java
    Replies: 1
    Last Post: 09-28-2009, 01:57 AM
  2. PLSQL - JAVA Integration
    By ttkong in forum JDBC
    Replies: 0
    Last Post: 04-09-2008, 08:31 AM
  3. Replies: 0
    Last Post: 04-01-2008, 10:17 AM
  4. Using a cursor
    By notnumber6 in forum New To Java
    Replies: 3
    Last Post: 11-26-2007, 10:56 PM
  5. Replies: 0
    Last Post: 09-28-2007, 12:56 PM

Posting Permissions

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