What is the difference B/w these two statements????????????????

Posted on 2006-03-26
Last Modified: 2010-04-01
In my program...i am closing the CallableStatement object like....this

Ist Method:

CallableStatement stmt = session.getCallableStatement("deleteUsers");



stmt .close();

Let me know what is the difference between these two methods...........Or if these are the same..........?????????
Suppose i didn't close the statement and resultset objects it is reducing the performance of the application or is not a matter regarding the performance.


Question by:ramareddyj
    LVL 11

    Accepted Solution


    Ist Method:
    CallableStatement stmt = session.getCallableStatement("deleteUsers");

    -->> This seems to be something customised in your application. There is nothing like getting the callable statement as you said.

    stmt .close();

    This is the normal way of closing the stmt. If you close the statement the resultset bundled with the stmt will automatically gets closed.
    Only thing to care about is closing of rs, stmt and connection should be done in finally block of try-catch-finally.

    LVL 16

    Assisted Solution


    As what fargo said.

    It seems that the first one is using Design pattern of
    The second method is the normal way we close the statement. I am not sure about the first one but I always used the second method.

    By looking at its implementation, they both are the same.


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to improve team productivity

    Quip adds documents, spreadsheets, and tasklists to your Slack experience
    - Elevate ideas to Quip docs
    - Share Quip docs in Slack
    - Get notified of changes to your docs
    - Available on iOS/Android/Desktop/Web
    - Online/Offline

    Suggested Solutions

    Title # Comments Views Activity
    what is stuck threads? 3 87
    constructor overloading 2 70
    AlarmClock Challenge 35 143
    Best practices to work on a spring MVC project 1 107
    Digital marketing agencies have encountered both the opportunities and difficulties that emerge from working with a wide-ranging organizations.
    Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now