Difference between closing the connection before and after committing user transaction?

          I was wondering what's the difference between closing the connection before committing
          the transaction versus closing the connection after committing the transaction?...
          for e.g....
          Scenario 1.........
          UserTransaction useretran;
          usertran.begin();
          Connection con = datasource.getCOnnection();
          // do bunch of stuff...
          conn.close();
          usertran.commit()
          Scenario 2...
          UserTransaction useretran;
          usertran.begin();
          Connection con = datasource.getCOnnection();
          // do bunch of stuff...
          usertran.commit()
          conn.close();
          thanks....
          Srini
          

Hi. As long as you're sure there's a transaction going on, and the connection
is a transaction-aware object (from a TxDataSource), either will be fine.
In the first scenario the actual semantics of the close() call are less than
normal, because we really don't close the connection or return it to the
pool until the actual transaction commits, and in the second case, we have
already taken the connection out of your service as of the commit().
The second scenario is the usual coding style. If there's ever a chance your
code will get non-transaction-aware connections, it is crucial to close
connections, and I always recommend putting the close() in a finally block
so it's guaranteed to happen.
Joe
srinivas wrote:
I was wondering what's the difference between closing the connection before committing
the transaction versus closing the connection after committing the transaction?...
for e.g....
Scenario 1......... UserTransaction useretran; usertran.begin(); Connection con =
datasource.getCOnnection(); // do bunch of stuff... conn.close(); usertran.commit()
Scenario 2... UserTransaction useretran; usertran.begin(); Connection con = datasource.getCOnnection();
// do bunch of stuff... usertran.commit() conn.close();
thanks....
Srini

Similar Messages

  • How can I control the space before and after text in a table

    Hello
    I have a series of icons with descriptions, these are lined up with icons on the top row and description text in the bottom row. Each icon and description is divided by a stapled line.
    The text is of varying width, therefore the column width must also wary. However I would like to make the space before and after the text equal in all instances (See image).
    If there is anyone that can tell me how to do this with tables or any other tools I would be very thankful.

    The only way I can think of to maintain equla spacing between the text ov vartying lengths and the vertical lines is to put each icon/text pair in it's own frame fitted to content, make each vertical line a separate object, then select them all and distribute the spacing.

  • Can I control the spacing before and after a signature?

    When using the Mail app, can I control the spacing before and after a signature? It seems like the app adds space, but it doesn't add the same amount every time.
    Thanks.
    Greg

    The only way I can think of to maintain equla spacing between the text ov vartying lengths and the vertical lines is to put each icon/text pair in it's own frame fitted to content, make each vertical line a separate object, then select them all and distribute the spacing.

  • Are there any difference between fx. the Nvidia FX3800 and GTX 260?

    Does anybody understand why I fell frustrated and confused about all this videocard discussions?
    Some tells me that the FX3800 is a better card - more pro - stabillity etc. than low-price cards - like GTX 260/285/295 - and some tells me that GTX 260 = FX3800. I read on other webpages about how people are having problems having their GTX 260 recognized as a FX 3800 (not in PPro but by Nvidia software). Other places tells about how to softmod GTX 260 to a FX 3800. Some tells me that there is a big difference between these cards - others they are almost alike - same GPU etc. I read that the difference between GTX 260 and FX 3800 is only the looks of it from outside - inside they are alike - and that apart from that only drivers are different.
    I have ordered the FX 3800 - believing it will perform better and more stable and give me really good playback rendering inside PPro CS5 compared to my GTX 260. If I get the same performance and stability by just changing two lines in a textfile with my old GTX 260 I feel cheated...I hope this is not happening.
    Someone from Adobe or Nvidida - please tell us - what there is a differnece between fx. the GTX 260 and the FX 3800 besides from the outside look and some drivers? If there is no difference between them - I can not see any other reason for only supporting the FX cards than $$$...If there are a difference in Quadra/FX favour - and I sincerly hope so -  I understand why you choose Quadro cards - but if they are just alike inside - I just feel we have all been mislead. I could have saved my money...time will show - I get the FX 3800 in a few days...can´t return it (danish rules when you buy it as a company) - so I´m 1000$ short this month...:(
    I would feel much more comfortable in having ordered the FX 3800 if someone from Adobe could tell me excactly how much better FX 3800 is from the GTX 260 - apart from being supported and the GTX is not. And if there is more in it than just changing a simple textfile? Are there any more things going on inside PPro - deep inside - that affects performance with FX cards besides from two lines in a textfile? Who can help answering that question - and I mean really answering it in serious way - not just saying - off course the FX is better - because its more expenssive.
    Haven´t we all experienced this in other situations? Like buying a car? Fx. Inside SKODA FABIA is a VW engine like the ones used in much more expensive VW cars. Only difference is the name and the outside look - and some comfort. The engine is the same - and in a way you could say that from an engine-point-of-view - the cars are alike. But you pay for comfort.
    Is the same thing going on here? I pay more for FX 3800 for the looks of it from the outside and some software-drivers that makes it more stable - but inside it is just like GTX 260? So from a graphic-performance-GPU-point-of-view I actually have two cards that are alike and I reaaly am paying for software and not hardware?
    /Morten

    You are right -. and I keep spanking myself in the head with a wet towel.
    I will lie in my bed - thinking of the nice new bicycle I could have bought instead of the FX 3800....;-)
    No seriously - I know what I have done - and maybe I have done right - I don´t know? Time will show and I will sell or buy.
    What I am frustrated about is the fact that I actually just decided to buy FX 3800 because Adobe and Nvidida toold me too -  to get support for MPE and now it seems that my old GTX 260 is much like the FX 3800 if not the same inside? And I am frustrated about that it is possible to change a line in a simple textfile and suddenly get support for the GTX 260 to play MPE. This fact only put more lit on the conspiracy-fire about Adobe and Nvidia having made a simple software-trick to make some cards work others not = making a lot of money on fools like me...
    You must admitt it is a rather tempting conclusion - if one is in the conspiracy-mood. Well - I try to think good about people. And Adobe convinced me at last that I needed the FX 3800 card. So I did order it eventually - because I need the MPE NOW - Can´t wait - having so bad performance and issues with PPro 4 - been so frustrated about edditting for almost ½ a year now - constantly having issues etc. And I am going to start new big project in 7 days. Have just spend 2000$ on upgrade to Master Collection and have making thoughts about wich card to buy long time ago - the GTX 285 or FX 3800 - to get the MPE support. And same day I order I suddenly see that the softmod makes my old GTX 260 to a FX 3800. And other posts claim that the cards are the same inside. No wonder I get frustrated - others must be the same.
    So what I am trying to say is that: I feel like Adobe and Nvidida is not being honest with us. If it turns out that the only thing Adobe has done is making a simple textfile to make cards supported or not by enteringior changing the names of the cards inside the textfile - and nothing else....And if fx. a softmoded GTX 260 turns out to perform excactly the same and be as stable as a FX 3800 to 5-6 x the price - I will feel cheated and feel like a stupid fool.
    I certainly do not hope this is what is going on. But it seems no one can help me but myself - testing and trying these cards - and I will try to post my results in this forum - so others might have easier tomake a choice...
    I´l be back....
    Cheers

  • What's the difference between using a connection pool and a datasource

    Howdy. I figure this is a newbie question, but I can't seem to find an
    answer.
    In the docs at bea, the datasource docs say
    "DataSource objects provide a way for JDBC clients to obtain a DBMS
    connection. A DataSource is an interface between the client program and the
    connection pool. Each data source requires a separate DataSource object,
    which may be implemented as a DataSource class that supports either
    connection pooling or distributed transactions."
    In there it says the datasource uses the connection pool, but other than
    that, what is the difference between a connection pool and a datasource?

    Thanks for the info. I think it makes some sense. But it's a bit greek.
    I'm sure it'll make more sense the more I work with it. Thanks.
    "Chuck Nelson" <[email protected]> wrote in message
    news:3dcac1f5$[email protected]..
    >
    Peter,
    Here is a more formal definition of a DataSource from the Sun site
    "A factory for connections to the physical data source that thisDataSource object
    represents. An alternative to the DriverManager facility, a DataSourceobject
    is the preferred means of getting a connection. An object that implementsthe
    DataSource interface will typically be registered with a naming servicebased
    on the JavaTM Naming and Directory (JNDI) API.
    The DataSource interface is implemented by a driver vendor. There arethree types
    of implementations:
    Basic implementation -- produces a standard Connection object
    Connection pooling implementation -- produces a Connection object thatwill automatically
    participate in connection pooling. This implementation works with amiddle-tier
    connection pooling manager.
    Distributed transaction implementation -- produces a Connection objectthat may
    be used for distributed transactions and almost always participates inconnection
    pooling. This implementation works with a middle-tier transaction managerand
    almost always with a connection pooling manager.
    Does that help clarify the distinction?
    Chuck Nelson
    DRE
    BEA Technical Support

  • What's the differences between connectors the old ones and newest ones?

    i developed an application with tomcat jakarta 5.1-mysql-java servlets, and i had been using the mysql-connector-java-3.1.8-bin.jar connector a little old uh, my question is what is the differences between the last mencionated and this version mysql-connector-java-5.0.0-beta-bin.jar, you say "just the version", i mean, i know there are many changes in the new ones but i don't like the idea to change all my application, and i would like to know what changes i have to do for update and compiling with them. i.e. i always did it like this:
    import java.sql.*;
    public class MultiUsos {
    private final static String log = "x";
    private final static String pswd = "x";
    private final static String Bd = "x";
    private final static String URL = "jdbc:mysql://localhost:3306/"+Bd;
    private Connection con = null;
    private ResultSet rs = null;
    private Statement stmt = null;
    private Conexion conexion = null;
    public int insert(String query) throws SQLException {
    try {
    con = conexion.getConexion(URL,log,pswd);
    con.setAutoCommit(false);
    if(con != null) {
    stmt = con.createStatement();
    r = stmt.executeUpdate(query);
    stmt.close();
    else System.out.print("� No existe conexion !");
    catch(SQLException e) {
    System.out.print("Error MySQL: ");
    e.printStackTrace();
    r = 0;
    return r;
    con.commit();
    return r;
    public void liberaConexion() {
    try {
    stmt.close();
    con.commit();
    con.close();
    catch(Exception e) {
    and i looked this example in new connectors:
    PreparedStatement pstmt = connection.prepareStatement("insert into......
    and things like that, i don't know if there were the same method in the older versions but if this is exclusive new for connectors, i'm fried.
    i will apreciate all comments and help, and sorry about my not good english.
    thanks.

    and i looked this example in new connectors:
    PreparedStatement pstmt =
    connection.prepareStatement("insert into......
    and things like that, i don't know if there were the
    same method in the older versions but if this is
    exclusive new for connectors, i'm fried.I am not sure if I understood your problem correctly but as I understand, you are worried because of the examples of PreparedStatement. That is an object representing a precompiled SQL statement. It is a part of the JDBC API, the same as Statement. There are several situations where the use of PreparedStatement is better than the usual Statement but this does not make the Statement obsolete.
    I would suggest you to read the JDBC tutorial
    http://java.sun.com/docs/books/tutorial/jdbc/
    especially the section dealing with the use of PreparedStatement.
    http://java.sun.com/docs/books/tutorial/jdbc/basics/prepared.html
    In general, it is better if you go through the complete tutorial and understand the features which are provided in the JDBC API.
    Hope I was helpful.

  • What is the difference between using the command "dsmgmt" and the "Managed By" tab when adding users to the local administrators Account on a Read-Only Domain Controller?

    When I use the
    "dsmgmt" command to add a user to the local administrators account of a RODC I can actually see the user when I use the "Show Role Administrators" parameter. However, I can't see the members of the
    group added to the "Managed By" tab of the RODC object in AD. Even though, the users added using
    "dsmgmt" and by the "Managed By" tab can all log in locally and have admin rights to the RODC. Are there any differences between these two ways of adding users to the local administrators account? 

    Hi,
    For groups, managedBy is an administrative convenience to designate “group admins”. Whatever principal listed in
    managedBy gets permission to update a group’s membership (the actual security is updated on the group’s AD object to allow this).
    In Win2008 and later managedBy also became the way you delegated local administration on an RODC, allowing branch admins to install patches, manage shares, etc. (http://technet.microsoft.com/en-us/library/cc755310(WS.10).aspx). 
    On the RODC, this is updating the RepairAdmin registry value within RODCRoles.
    So the difference between them should be only the way they do the same thing.
    For more details, please refer to the below article:
    http://blogs.technet.com/b/askds/archive/2011/06/24/friday-mail-sack-wahoo-edition.aspx
    We
    are trying to better understand customer views on social support experience, so your participation in this
    interview project would be greatly appreciated if you have time.
    Thanks for helping make community forums a great place.

  • Difference between using the Enterprise Portal and SAP GUI

    Hi Gurus,
    Could one of you please send me a document that lists the differences between the Enterprise Portal and SAP GUI?
    thanks in advance

    Hi,
    For groups, managedBy is an administrative convenience to designate “group admins”. Whatever principal listed in
    managedBy gets permission to update a group’s membership (the actual security is updated on the group’s AD object to allow this).
    In Win2008 and later managedBy also became the way you delegated local administration on an RODC, allowing branch admins to install patches, manage shares, etc. (http://technet.microsoft.com/en-us/library/cc755310(WS.10).aspx). 
    On the RODC, this is updating the RepairAdmin registry value within RODCRoles.
    So the difference between them should be only the way they do the same thing.
    For more details, please refer to the below article:
    http://blogs.technet.com/b/askds/archive/2011/06/24/friday-mail-sack-wahoo-edition.aspx
    We
    are trying to better understand customer views on social support experience, so your participation in this
    interview project would be greatly appreciated if you have time.
    Thanks for helping make community forums a great place.

  • Whats the difference between turning the ipod off and putting it to sleep?

    is there a difference between turning off the ipod by holding the play button and selecting sleep in the main menu?

    As far as I can tell, it's just another way of turning the iPod off.

  • Differences between renders inside C4D Lite and After Effects.

    I have a weird problem with an object set as a shadow catcher which looks fine in C4D but then shows the margins when rendered in AE. I'm not talking about the OpenGL view in C4DL, I'm talking about the render when you press the "Render View" button. This is what it looks like:
    However, the updated file in AE looks like this:
    As you can see, the plane that I set as a shadow catcher shows the edges, but I can't figure out why. Granted, this is something that would have been easier to do with the Raytracer in AE, which I did, but I'm trying to learn C4D.
    Any suggestions?

    RobertJF wrote:
    Looks like you've got a subtle light line around the top edge of your text as well, but not around the text where it overlaps the shadow catcher layer. Are you rendering the background through to AE or is the footage a separate layer in AE? Looks like an alpha problem to me given that it appears around the top edge of the text as well.
    You were right, I failed to see that C4D files also have an alpha that you can set in the interpret footage dialog. In this case it was set to premutlipled and it has to be set to straight.
    Thanks!!!

  • Xl reporter shows different result before and after Period-End Closing.

    Hi SAP experts,
    We have an issue with XL Reporter. When we ran Period-End closing and ran XL - PL Period & YTD (with the same parameters), XLR shows nil in the Actual YTD column and the monthly figures are out by a big difference (example pre-rollover it was $110K after rollover it shows negative $12M).
    This happens on 2 different clients running 2 different SAP B1 (2007A PL 42 and 8.8 PL 13) on the same XL Reporter which is possibly the default XL report that comes with the installation.
    I don't have any idea why the XLR is running 2 different figures altogether when running the same XLR using the same parameter before and after rolling the year over. The default SAP B1 P&L report stays the same before and after the rollover, I would have expect that the same would happen with the XLR.
    Please advise.
    Regards,
    Didy Arfiono

    Hi Julie,
    Thanks for the reply. I'm not entirely sure what you mean by excluding a certain transaction for closing entries as this would defeat the whole purpose of PEC which as you stated was to transfer P&L balances to retained earnings account to be carried forward.
    I've check at some guides including one from Orchestra Team (http://www.youtube.com/watch?v=e4tUo774eXg) and so far the process that I've done is exactly what it is.
    Regards,
    Didy

  • Split view for before and after changes?

    One feature I used to use a lot on Lightroom as where it would show a split view showing the image before and after changes (adjustments). I cannot find how to do this in Aperture - is it possible, what is this feature called?
    (and before any smart person tells me to look in help, I'm tired of responses like that. I've looked and didn't find, and that's why I'm asking here. I've tried Compare, and Before and After Changes etc.)

    Unfortunately, no, there is no ability to do the split view like Lightroom has. It's a nice feature.
    The closest you can do is to flip back and forth between two versions. Because when you view the master in aperture it shows the original file without crops and straightening, I suggest that once you crop and straighten, you then create a new version and work on that (this is as close as you can get to LR's "snapshot" functionality). You can then flip back and forth between the two versions to see the changes... but you can't see them side by side with a split.

  • Changing transition changes time of clip before and after???

    When I add or change the transition time, after it renders, the time of the clip before and after the transition automatically changes. I've done it several times and it shortens the time of the clips before and after the transition. Why does it do tht? Its driving me nuts. I keep changing back the time on the clip but when it re-renders it goes back to the time after I changed the time on the transition. Help please thanks lots

    Hi Iluvvartan - that is normal. Transitions use portions of the clips adjacent to them. Cross dissolves for example take a portion from each, and the total length of the project is reduced. The Overlap transition only affects the length of one of the adjacent clips, and the total length of the project remains unchanged.

  • Space before and after list

    How can I manage the space before and after a list in a book without local formating each list? IE I would like all the formating to remain in each style.

    For bulleted lists, I have two bullet styles. Bullets_L1 is for first level bullets, and has no paragraph spacing. I use the style Bullets_L1_First for the first bullet in the list and this has paragraph spacing before which matches the body style of the document and have Bullets_L1 set as the Next Style. This means that there is paragraph spacing above the first bullet and non for the remainder. The space at the end if the list is handled by the body style.
    If I am manually typing the list, the change from Bullets_L1_First to Bullets_L1 is handled automatically. If I am formatting text that has been placed without these styles, I highlight all the paragraphs I want bulleted and right click on Bullets_L1_First in the Paragraph Styles list and select Apply Bullets_L1_First then Next Style.

  • White spaces before and after Images

    I have several images in my FM document,
    They are either gif or jpg.
    All set in Anchored frames, left-aligned.
    I have made most of them conditional for Online help, so they
    dont show up in my Online help.
    My issue is I am not sure how to remove all the space that
    appears before and after the images (they are not displayed because
    I have set it to conditional)
    I remember somewhere that the spaces for such images can be
    removed.
    Please let me know if there is.

    Hi,
    Thanks for replying.
    I have removed the spaces before and after the images in
    Frame.
    Set the images to be conditional (only for print). If there
    are any images they are in anchored frame--left aligned.
    So my problem is that the space before - after and the place
    where the image originally was (now not displayed as it is
    conditional) have these huge white spaces displayed.
    I am not sure how to map them or how to delete them.
    I am familiar in FM, and Robohelp (although i have worked
    with Word only and it was easy). For some reason this seems too
    hard.
    Hope I have gotten across to you with my question.

Maybe you are looking for

  • What do I need to connect my white macbook to my TV and get audio?

    I have Macbook 6,1. Upgraded with a OS X Lion 10.7.2. I have bought the Kanex Mini DisplayPort to HDMI cable with aduio support. I have been successful in hooking it up, to allow the display to work but I can not seem to get audio. I have found throu

  • Ipod says has no music right after restoring and syncing

    It started with my ipod randomly going to menu in the middle of a song. Then it started skipping. And finally it would go from song to song but wouldn't play. So I restarted it while walking to class. When it got back to the menu it said there were n

  • Error in Message-Mapping transformation

    I'm getting an error while processing the data from JDBC to SAP through IDOC's. During the application mapping com/sap/xi/tf/_MM_HRMD_ a com.sap.aii.utilxi.misc.api.BaseRuntimeException was thrown: RuntimeException in Message-Mapping transformatio~ w

  • Slow display of shared playlists?

    I stream Music and TV show playlists from my Mac to the Apple TV (connected via 802.11n, the Mac is GigE). I'm also syncing movies from another Mac. When I go view the shared playlists initially, the Apple TV says "no playlists." After a few minutes,

  • Shared devices finder window freezing

    I am using 10.7.5 with a shared network via Airport Extreme.  I have been using this for many months no error.  No updates, no changes, just came in, opened my laptop and the "shared" sees the base stations but when I click on them, the folders don't