Question on design change

Hi
I have inherited a system built using servlet/jsp.
We have a page where it displays all the orders for a customer. This page comes up really slow.
When I loop thru the code , I noticed that connections are made all over the place.
For example , To get the order header details one connection, then for every line in the order uses more new connection , then to get the details of the order line(DB contains product code ,to get description makes another connection)
This happens for every order for a customer. so I think closing and opening the connections takes a while.
I m thinking of obtaining one connection and pass it all the way down as a parameter. For this I have to change every method starting from the order level.
Is this the right way to approach it?
Please advise
TIA

You definitely want to share the connection. Opening and closing a connection is a relatively expensive process. Further, you will have difficulty implementing transactions (e.g. commit and rollback) without holding onto the same connection.
Consider creating two versions of each method, one that takes a Connection (or ideally, a custom Transaction object) and one that doesn't. The signature without the transaction will call the overloaded version with the transaction. This allows you to call a given method atomically (with a commit) or within another transaction (logical unit of work).
final public void foo(final int primaryKey, final String value) {
Connection conn = newConnection(); // implement somewhere else, preferably in a DAO or helper
try {
foo(primaryKey, value, conn);
finally {
if (conn != null) conn.commit();
final public void foo(final Connection connection, final int primaryKey, final String value) {
// Do work here but do not issue a commit; may issue a rollback
If you use a J2EE implementation (e.g. Weblogic, Websphere, etc.), they actually pool connections. Normally, the number of open connections on a database can be a scaling bottleneck. By pooling the connections, more threads can get access to database resources. It is a lot of overhead, and the fact it is implemented as a standard option in most containters shows how important database connection management is.
Definitely at least re-use a given connection within a logical unit or work. (Even if you do not want to create two copies of each database method). Otherwise, your application will be unecessarily slow and overuse scarce database resources.
- Saish
"My karma ran over your dogma." - Anon

Similar Messages

  • How can I change my original security questions? After changing my AppleID and password, I am not given an opportunity to change my security questions, which I cannot remember the answers to, so I cannot purchase any music.

    How can I change my original security questions? After changing my AppleID and password, I am not given an opportunity to change my security questions, which I cannot remember the answers to, so I cannot purchase any music.

    See my User Tip for some help: Some Solutions for Resetting Forgotten Security Questions: Apple Support Communities.
    Send Apple an email request for help at: Apple - Support - iTunes Store - Contact Us
    Call Apple Support in your country: Customer Service: Contacting Apple for support and service

  • Hi i cant remember securities questions. i want change but in mange of apple id is not possible

    hi i cant remember securities questions. i want change but in mange of apple id is not possible

    account security
    Please call apple @ 1-800-694-7466
    ask for the account security team
    you may want to add a credit card to your iTunes account  before calling; so they will have a way to verify your identity.
    Peace, Clyde

  • This database was connected to a Microsoft Access Services site that is not compatible with this version of Microsof Access. You cannot make design changes or modify data in database.

    Hello All,
    I am getting this error while I am connecting my access database website for the change
    "This database was connected to a Microsoft Access Services site that is not compatible with this version of Microsof Access. You cannot make design changes or modify data in database."
    I am using SharePoint 2010 and Microsoft Office 2010.
    I have created one Contact Database Site and now I am trying to modify the layout of the form in Access. and I am getting the error that I have mentioned.
    Please provide help on it.
    Thanks in Advance....

    Hello All,
    I got the answer, we have to enable the port 80 or where the access service is deployed and we have to change Trust setting and also, enable the macro from Access.
    Hope this will help to other....

  • A question about design of Java Application on java card.

    Hi every one,
    I have a question about design of Java applet on java card,
    There is an application on my card that it is not java card, it include a DF and some EF under DF, I would like to know if I want to have this application on java card ,how can I design DF and EF on java card ,I mean is there any relation between DF,EF with applet and file? for example can I say DF is same as applet and EF is same as file?
    I'll appreciate for any help .
    yours sincerely,
    orchid

    hi
    you can write a java class for DF.
    an instance of DF class have some EF objects.
    for example,
    samples/com/sun/javacard/samples/JavaPurse/CyclicFile.java
    implements ISO 7816 CyclicFile ( EF )
    see also:
    http://forum.java.sun.com/thread.jspa?threadID=673745&messageID=3936272
    best regards,
    siavash

  • Hello, small question, how to change the bank details my account is on? keep on charging the old card nr of a friend ;-(

    hello, small question, how to change the bank details my account is on? keep on charging the old card nr of a friend ;-(

    Go to iTunes, click on your Apple ID (right top iTunes' corner), enter your paswword if requested and edit the details you want

  • Question regarding  to changing the region of the app with remaining balance

    Question regarding  to changing the region of the app with remaining balance
    Hello, I am attempting to change the location of my app store which has remaining balance of 0.01$. In order to change the location of the store, it requires  spending all the remaining  balance. As my balance is too low " 0.01$" to buy an app from the store, I am not able to change the region of my app store. Moreover, Since I am not a residence in USA, I am not able to use my credit card either.
    I am wondering if it is possible to change the location of my app store with a remaining balance OR  to delete my current balance.
    Thanks
    Nejem 

    Click here and request assistance.
    (85511)

  • Im from isreal and i forgot my security question and cannt change them what can i do?

    im from isreal and i forgot my security question and cannt change them what can i do?

    Forgotten Security Questions / Answers...
    See Here > Apple ID: Contacting Apple for help with Apple ID account security
              Ask to speak with the Account Security Team...
    Or Email Here  >  Apple  Support  iTunes Store  Contact
    More Info >  Apple ID: All about Apple ID security questions
    Note:
    You can only set up and/or change a Rescue Email Before you forget the questions/answers.

  • Design change or install problem

    My upgrade to Aperture 3.01 went relatively smoothly. It is now up and running and generally I am satisfied. There are two annoying issues and I am wondering if they are a design change or related to a problem with my install.
    I can not scroll through the full screen images using my scroll wheel. Thumb nails scroll fine but larger images do not respond.
    I can no longer see my aperture library in my desk top setting to select images for background display.
    Am I along here or is everyone else who upgraded now missing these features?

    Not sure what you are using to scroll, but I can confirm the two-finger swipe using the Magic Mouse does scroll through the images in fullscreen mode as well as the thumbnails in the browser.
    As for Aperture not showing up in the System Preferences -> Desktop, they may not be there immediately when you first install Aperture as the Desktop function seems to need to be refreshed. I would think if they do not appear, restart the computer and you will see them. There will be a disclosure triangle for Aperture that you need to open to reveal your projects etc.

  • A Set Of questions on Designer

    Hi,
    I have a customer issues where-in I need help in answering below mentioned questions.
    Its a very high priority customer & need answers urgently.
    Can any one help me in this regard.
    Questions Below
    1) I assume the meta-meta model has expanded to handle new Oracle features.
    A quick look at a diagram labeled sdd_elements designer_6i-9i_Model suggests that the basic
    model has not changed. I would like to confirm this. I would also like to see what elements are now supported. A listing of the name column from the element_type table would give me this. This table is
    recursive. A recursive list that shows subtyping would be ideal but is not critical.
    2) Is the API still fully supported? When the API was initially published all of the screens in the designer tool were revised to use the API. Is this still the case?
    3) What diagrammers are supported? At one time there where plans to allow users to customize and extend diagrammers. Has this ever happened? The automatic layout functionality of the data model
    diagrammer used to be very primitive. Have they been improved? I have been hoping for options that would prohibit knees in FK lines, that would prohibit diagonal lines and that would prevent line through boxes.
    4) How complete is reverse engineering?. Can I reverse engineer a database and then forward engineer the complete database including the create database, create control file and create tablespace statements.
    Can I reverse engineer from older Oracle versions (8 and 9). Can I reverse engineer with the source on another machine via SQL*Net.
    5) How complete are the Configuration Management components? How complete is the impact analysis?
    What non-Oracle sources are supported by impact analysis? Can any of these non-Oracle sources be incorporated into the Configuration Management.
    6) Are there direct links from Oracle to 3rd party configuration management tools? I believe we will be using PVCS.
    Thanks in advance.
    Regards,
    Nagadeep

    Hi Laura,
    Eventhough the code is not difficult, there's no sample for that. The procedure is well described in the following lines, that i took form thread few questions....
    1. On 2005 version you can use the Grid & Data Table in cases you want to show query result - the Data table allows you to write open SQL query statement (use the "order by" in it) & the Grid automatically refreshed with the query result data (columns & rows).
    On 2004 – The DBDataSource does not contain sorting capabilities… the only way is to fill the DBDataSource manually from sorted record set, bind it (column by column to matrix on the form) and load it from the data source (activate Matrix::LoadFromDataSource). The manually filling will cost – but I cannot see better solution for it under DBDataSource).
    Perhaps after you tried it, you can share the code :o)
    Best regards,
    Felipe

  • Question related to changing query from Production to Development

    Hello friends i have a question,
    I did query designing and transported it to production.
    Now there are lots of modification needs to be done in it.
    So can i change the queryin production or not.
    If i have to do modification what shall i do?
    If i do it in dev again, how to transport it back to production.
    what precaustion i need to take.
    thanks

    Hi Kartikey,
       Follow the below steps.
    1.Goto transport connection in RSA1 of ur development.
    2.Click on icon Bex.Create a Bex request.
    3.Edit ur query.Assign it to created Bex request.
    4.Transport it to Production.
    Your previous query in Production will be over written by the new Query.
    Assigning points is the way of saying thanks in SDN.
    Madhu.

  • Questions on board change

    I have questions on the motherboard change I'm about to do and obviously I'm amateur with this stuff so please bare  with me.  my question is I'm installing the MSI K7N2-l with AMD Athlon X.P. 2000+ Palomino core.  
    I was wondering when I switch motherboards can I put in my current hard drive with windows XP and just reinstall the current drivers for this new motherboard, or is there something else I need to do? I understand that before I remove the old motherboard I will need to uninstall any drivers or bios pertaining to that board before proceeding, is this correct?  Thank you for your patience any information would be greatly appreciated!
    Bill

    It really depends on how much trouble just backing up critical data and doing a clean install is for you....I do recommend a clean install...but as you stated uninstalling any ide device, pci controllers and such will probably get you into a windows enviornment with the new board, but it is hard finding all previous registry entries....I would try a repair/ not a reinstall of the os from the XP cd itself.

  • 3 questions on visual changes and positioning

    Hello everyone,
    I hope I have the right section for my questions. (so many categories) I have three questions that I hope I can get answered.
    Question 1 ) I am writing an application that uses a JDesktopPane. I have a menu that each choice opens up a JInternalFrame. One of my internal frames contains option settings for the app. One of the option selections is the type of look and feel of the gui. I have three JRadioButtons that chooses the three built in types. When I use the method (see below) to change the gui look, it only effects the Internal Frame, not the rest of the app. Is there a way I can get it to change the rest of the frames and the main JDesktop.
    private UIManager.LookAndFeelInfo looks[];
    public void lookAndFeel()
              looks = UIManager.getInstalledLookAndFeels();
              try
                   UIManager.setLookAndFeel(looks[lookChoice].getClassName());
                   SwingUtilities.updateComponentTreeUI(this);
              catch(Exception exception)
                   try
                        UIManager.setLookAndFeel(looks[0].getClassName());
                   catch(Exception guiException)
                        // Nothing yet...
         }Question 2 ) Positioning --- I understand how to use layout managers, but is there a way I can override the positioning of objects? Sometimes, I want to postion objects to a point. Instead of automatic positioning.
    Question 3 ) Adjusting properties --- I notice that when I create a different font and if I want an object to use that font then I need to setFont() for the object. Unfortunately, I have noticed that this needs to be done for every object. Is there a way to set the font for all the objects in a JPanel or JFrame at once?
    Thanks everyone, (sorry for the numerous questions, just has been building for awhile)
    7

    Question 1 ) I am writing an application that uses a
    JDesktopPane. I have a menu that each choice opens up
    a JInternalFrame. One of my internal frames contains
    option settings for the app. One of the option
    selections is the type of look and feel of the gui. I
    have three JRadioButtons that chooses the three built
    in types. When I use the method (see below) to change
    the gui look, it only effects the Internal Frame, not
    the rest of the app. Is there a way I can get it to
    change the rest of the frames and the main JDesktop.Try doing
    revalidate();
    repaint()
    on all of them
    Question 2 ) Positioning --- I understand how to use
    layout managers, but is there a way I can override the
    positioning of objects? Sometimes, I want to postion
    objects to a point. Instead of automatic positioning.Your choice is either to call setLayout(null) and set component positions yourself or to create/extend your own layout manager
    >
    Question 3 ) Adjusting properties --- I notice that
    when I create a different font and if I want an object
    to use that font then I need to setFont() for the
    object. Unfortunately, I have noticed that this needs
    to be done for every object. Is there a way to set the
    font for all the objects in a JPanel or JFrame at
    once?Not that I can think of. Why not just create one method where you can set everybody's font with a font parameter?
    >
    Thanks everyone, (sorry for the numerous questions,
    just has been building for awhile)
    7

  • I understand the design change to the whole "save as app" tab, but I feel that Save and Quit feature from the previous version of Firefox is much better than this "app tab" feature. Is there anyway for me to have this back?

    Restore previous session button available on my Firefox homepage is great, but what I really want is the Save and Quit feature. I have always felt that its one of the best features of Firefox, second only to search address bar directly leading me to the actual page. I read some threads about this, and found the answers very unconvincing. One of the suggested ones was "Pin as app tab" . No, I don't want to pin every tab that I want to visit say, thrice as an app. Second suggestion was, click on the obvious button on the homepage to restore the tabs(this took me quite a while to actually see). Why this change in design? This is identical to Chrome's but its very inferior to what Firefox already had. Is there anyway, without downgrading of course, I can get that feature back?

    Okay, I found the answer myself. Going to about:config and setting browser.showQuitWarning to true, restored that option and brought it back. Thanks to anyone who is about to post. If this is false by default, it has got to change.
    -- Sorcus

  • Query Designer : change in charactristic

    Hi Experts,
    I have changed long text and short text of one charactristic but it is not reflecting the new name in reports.when i checked it in query designer on the left hand side under Dimensions it is showing me the new name but in Free charactristics it is still displaying old name and so in reports. Is there any solution to this?
    Thanks in advance.

    Hi,
    Thanks you so much for quick replies. The thing is the charactristic was already there in reports. Now i canged the long text in the infoobject and  activated it. but in query designer under free charactristics, it is not changed. i tried to regenerate query from RSRT but not helping. I think as Dirk mentioned it is not getting changed at this level automatically , but do i need to change this char in every report where it is used manually? there is no any other solution?
    Edited by: soniya on Nov 19, 2008 1:07 PM

Maybe you are looking for

  • How do I create a new Sharepoint site at Home to connect with our own Website?

    How do I connect our website with our home computer. I am not linked with a company server site - just what has been created with the website, so how do I connect to a server or that server; know the server details and how can I link my Sharepoint wi

  • How to repair a TimeMachine Backup file

    I'm trying to use Migration Assistant to copy data and user info to a new MacBook Pro (10.9.4).  I created a fresh Time Machine backup file of the source iMac on a USB drive connected to my Airport Extreme.  Unfortunately, MA says 'No Volumes Found'

  • Coding in CoA.

    Hi gurus, Do we have use standard coding while preparing chart of Accounts? If Yes, than in which manner? If No, than How we provide numbering to chart of accounts? Thanks Hardik

  • CS4 Admin "You don't have permission to edit this page"

    I am new to Contribute.  Created a website in Dreamweaver CS4, using templates, can put and checkin files, seems fine.  FTP client has full access to all folders.  Site in browser OK, Dreamweaver OK.  Contribute starts and connects OK, access via FTP

  • Trying to RDP OSX Lion to Win7

    Last night I decided I wanted to learn how to RDP to my Windows 7 PC (im a first time mac user). I am using microsoft's RDP client, and I am so far unsuccessful at getting this to connect. I assume it is because I am not joined on the windows workgro