• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JDBC

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please tell me is there any short cut to use the same callable statement a number of times.
 
Ranch Hand
Posts: 168
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
When you say 'use' the same CallableStatement a number of times, what do you mean? If you want to execute the same stored proc, there shouldn't be a problem with that (in theory at least - I have never actually tried it), even if you are resetting input parameters between calls. To test this, find the part of your code that makes the execute() call, and duplicate it on the next line. If there are problems, you'll soon find out.
A word of warning though. A callable statement and its resultset are linked - this can cause memory leaks in some situations if you are not careful, although in my experience this happens when you are reassigning the same resultset rather than calling the execute method repeatedly on a callable statement.
If you have problems with that, post again and I'll tell you how I got around it.
Hope this helps
Michael
------------------
"One good thing about music - when it hits, you feel no pain"
Bob Marley
 
Ranch Hand
Posts: 243
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Mishra Dinesh Jee:
Please tell me is there any short cut to use the same callable statement a number of times.


It's a bit unclear what you want to do. But from what I can get from what you have said, you might want to look into PreparedStatements. It's like a statement, but you can use it several times with different parameters.
Hope this helps.
reply
    Bookmark Topic Watch Topic
  • New Topic