We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now

x

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

ramareddyj
ramareddyj asked
on
Medium Priority
189 Views
Last Modified: 2010-04-01
Hi...
In my program...i am closing the CallableStatement object like....this

Ist Method:

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

session.closeCallableStatement("deleteUsers");

IIMethod:

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 not...it is not a matter regarding the performance.

Thanks,
Venkat.





Comment
Watch Question

Commented:
Hi,

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

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

IIMethod:
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.

regards
fargo

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Hi,

As what fargo said.

It seems that the first one is using Design pattern of http://www.trsilvius-co.com/j2ee/daopattern.htm
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.

Thanks
David
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.