What would happen if this runs?

This is a 'real' code example that i found in this program. Could this cause connection pools to not be relased
Connection con = null;
stmt = con.createStatement();
int ret = stmt.executeUpdate(simple query);
con.commit();
con.rollback();
con.commit();
con.close

Connection con = null;
stmt = con.createStatement();You will get a NullPointerException here. :P
If we assume that you are getting a Connection from a DataSource...
int ret = stmt.executeUpdate(simple query);
con.commit();This should commit the updates (even if the auto-commit mode is set to false). It releases all the previous savepoints as well.
con.rollback();This won't have any effect.
con.commit();Neither would this.
con.close();If all this code is in one block, there is no guarantee that the connection will be closed. This should be in a finally block preferably. :)

Similar Messages

  • Can I Do This?  What Would Happen?

    Hello Everyone. I preordered my 3GS and received it last Friday at the store, and signed the 2 year renewal thing. My online account is still saying I am eligible for an upgrade and it will allow me to order the 3GS at the 199/299 price. What would happen if I ordered one at that price? Would they eventually charge me the difference in sub vs. non-sub price, or did something mess up in my initial renewal last week and it never process?
    Does your online account still say your eligible for an upgrade?

    What version of iPhoto do you have?
    Regards
    TD

  • What will happen when I run the HP Restore?

    Hello, I'm posting in reference to a bit of a dillema I have.
    As of about a month ago, I've been having errors with my laptop, and I've recently decided to perform a full system restore on my laptop to take it back to factory specs since I can't find a solution.  However, I've run into several problems in the process:
    I do not have a Windows 7 installation disc, nor do I have a Windows 7 activation code to create a USB installation disc.  There's no sticker on the back of my computer.  I have a Windows 7 SP1 disc, but I don't think that has the main installer, and I received an Autorun.dll error the very first time I opened the pack to use the disc.
    My computer did not come with the HP Recovery Manager software.  All the tutorials I've seen rely on this manager.
    I do not have a restore point from before these errors began.
    When booting my computer up a bit before I decided to come to the forums, I decided to test the startup menu and found an HP Restore option and decided to use it.  However, I didn't get the screen that appears in the tutorials on the website, but rather what looks like a generic installation screen for a Windows program.  I cancelled the HP Restore upon seeing this because I was unsure of what would happen.
    I'm here to ask, since my laptop came pre-installed with Windows 7 the very first time I turned it on, does this version of the HP Restore reinstall Windows?  If it does, that's fantastic, because as I mentioned I don't have a Windows 7 disc or activation key.

    I should also clarify, when I attempted to run the Windows System Restore, I was unable to because my computer couldn't find the Windows 7 installation files, and as mentioned before, I don't have any installation discs.  I have an HP Windows 7 SP1 disc (which from what I understand is simply a patch) and an HP driver installation disc.  This is why I'm hesitant to try the HP Restore (F11) option, because I don't know if it'll automatically install Windows when I use it.

  • What would happen if I used Recovery Disk?

    I've recently bought a new iMac (Core i5) that came with Lion pre-installed, but I needed Snow Leopard for all my older software e.g. Photoshop CS, so I got the sellers to install SL for me. Everything is fine.
    Out of curiosity I tried to see if I could run Tiger from my old G5 HDD which is connected via USB, but it didn't come up in the list when I did Restart + Option. However, what DID come up was an extra drive named "Recovery". I understand this is a separate Lion partition on my HDD - so, what would happen if I selected that via Restart + Option? Would it open Lion on my iMac so I could have a play around with it? And if it did, would I then be able to get back to SL and all my data, users, and settings, after I'd finished?
    I don't want to try it out without advice, in case Lion overwrites SL irretrievably.

    christopher rugby wrote:
    My question is this : can I safely restart from Recovery in order to just play around with Lion, or will starting from Recovery reinstall Lion over the top of SL on my main disk?
    If your machine only has SL and the Recovery HD, then the only thing you can do when booting into the latter is REINSTALL Lion on top of SL or do some basic things, but Lion isn't installed. Details in Recovery/ and About Lion Recovery.

  • I just backed up my mac to an external hard drive using Time Machine. What would happen if I turn Time Machine off and then plug the external hard drive back into my computer?

    I just backed up my mac to an external hard drive using Time Machine. What would happen if I turn Time Machine off and then plug the external hard drive back into my computer?
    What I am ultimately wanting to do is make more room on my computer by backing up all of my files onto the external hard drive and then deleting them off of my computer. However, neededing to be able to retrieve them from the external hard drive later down the road.
    From what I have read and am trying to understand, is that I probably shouldn't have used time machine. I need to use the external hard drive like a basic flash drive where I can put things on and get things off without having it automatically update through time machine everytime I connect it to my computer.
    Not tech savvy at all and barely understand basics. I need very simple and easy to understand explanations.

    sydababy wrote:
    and then deleting them off of my computer.
    BIG BIG MISTAKE ..... youre making a linchpin deathtrap for your data trying to shove everything on a single fragile HD.
    Dont suffer the tragedy other people make, buy another or 2 more HD, theyre cheap as dust.
    The number of people who have experienced terror by having a single external HD backup is enormous.  One failure that WILL HAPPEN, and kaput,......all gone!
    Dont do it, its all about redundancy, redundancy, redundancy.
    follow here:
    Methodology to protect your data. Backups vs. Archives. Long-term data protection
    Deleting them off your computer is fine....having only ONE copy is extremely BAD.
    The Tragedy that will be, the tragedy that never should be
    Always presume correctly that your data is priceless and takes a very long time to create and often is irreplaceable. Always presume accurately that hard drives are extremely cheap, and you have no excuse not to have multiple redundant copies of your data copied on hard drives and squirreled away several places, lockboxes, safes, fireboxes, offsite and otherwise.
    Hard drives aren't prone to failure…hard drives are guaranteed to fail (the very same is true of SSD). Hard drives dont die when aged, hard drives die at any age, and peak in death when young and slowly increase in risk as they age.
    Never practice at any time for any reason the false premise and unreal sense of security in thinking your data is safe on any single external hard drive. This is never the case and has proven to be the single most common horrible tragedy of data loss that exists.
    Many 100s of millions of hours of lost work and data are lost each year due to this single common false security. This is an unnatural disaster that can avoid by making all data redundant and then redundant again. If you let a $60 additional redundant hard drive and 3 hours of copying stand between you and years of work, then you've made a fundamental mistake countless 1000s of people each year have come to regret.

  • If I uninstall iTunes, what would happen to my music?

    I have been having issues with my iPod showing up on iTunes and I was thinking maybe I should completely uninstall it and then install it again. I'm very paranoid and don't want anything to happen to my library if I were to do this though. What would happen?

    Nothing will happen to it.

  • What would happen if application server needs to be restarted?

    I am talking about a scenario where application server hangs and needs to be restarted, because you couldnt do anything on it. What would happen to any insert, update of data taking place at that time. I guess it will all be rolled back if they are not committed and written on the data files. What would you do in this case before restarting , what would you check after restart of the system? Please share your experiences.

    Hi,
    >What would you do in this case before restarting , what would you check after restart of the system? Please share your experiences
    SAP has its recovery manager([click|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/a8910c3a-0d01-0010-a6a9-f4a8aae140fe] BR Tools) and every time you restart the server the system will be rolled back to the last safe point if there were any undone or not commited queries.
    Rakesh

  • What would happen if two concurrent threads try and remove ....

    Hello,
    I have a java test to give back tomorrow and I'm stuck on this question, could you help me please.
    Question: What is the difference between java.util.Vectorand java.util.ArrayList?
    I read everywhere that: The main difference between Vectors and ArrayLists is that Vectors are synchronized so any method that touches the Vector’s content is thread safe, which is not the case for ArrayLists.
    This part is ok.
    Now the second part of the question is:
    What would happen if two concurrent threads try and remove the third object
    of such a collection?
    I don't know what to answer. I could tell that if the vector or arraylist is smaller than 3 il will return an ArrayOutOfBoundException but what happen if they are longer?
    Thank you very much.

    RaptorKiller wrote:
    Hello,
    I have a java test to give back tomorrow and I'm stuck on this question, could you help me please.
    Question: What is the difference between java.util.Vectorand java.util.ArrayList?
    I read everywhere that: The main difference between Vectors and ArrayLists is that Vectors are synchronized so any method that touches the Vector’s content is thread safe ...hm. hmmm...
    I wouldn't say anything about Vector or its methods being thread safe.
    Thing is, [Vector javadoc|http://java.sun.com/javase/6/docs/api/java/util/Vector.html|javadoc] does not state anything like that.
    Rather opposite, javadoc says Vector hates concurrent modification just like any other non-concurrent collection: +"...The Iterators returned by Vector's iterator and listIterator methods are fail-fast: if the Vector is structurally modified at any time after the Iterator is created, in any way except through the Iterator's own remove or add methods, the Iterator will throw a ConcurrentModificationException... Note that the fail-fast behavior of an iterator cannot be guaranteed as it is, generally speaking, impossible to make any hard guarantees in the presence of unsynchronized concurrent modification..."+
    This part is ok.I don't think this part is OK. I would stick with wording given in javadoc: +"Unlike the new collection implementations, Vector is synchronized"+ // synchronized does not necessarily mean thread safe, and Vector is the case proving that

  • If I take my bank card details off my itunes account and opened a new itunes account what would happen to the old account?

    If I take my bank card details off my itunes account and opened a new itunes account what would happen to the old account?

    you're more likely to get quick and accurate answers to an iTunes question in the iTunes forum, this is the GarageBand forum

  • What would happen if you put iOS 7 on an iPod 4th generation? Just out of curiosity.

    What would happen if you put iOS 7 on an iPod 4th generation? Just out of curiosity.

    It will not install you will get an error message if you try to force an install.
    iOS: Restore error 3194 or 'This device isn't eligible for the requested build'

  • After transaction completed in undo tablespace what would happen? will they

    after transaction completed in undo tablespace what would happen?
    will they take out of undo tablespace or segment?
    please elaborate, thank you

    Hi,
    Even, if the transaction is committed, there may remains a need to retain the undo data. For instance, for the long running queries or for the flashback features. In automatic undo management, you may specify the undo retention period, which is the minimum amount of time that Oracle Database attempts to retain old undo information before overwriting it.
    One may also enable the retention guarantee, which ensures that the undo data will remain in the undo tablespace, even if that means that the transaction would fail due to lack of space in the undo tablespace.
    In addition, also read the following:
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14231/undo.htm
    regards

  • Mailbox has "archive" with thousands of emails in it, probably every email I've sent. What would happen if I deleted them?

    My Mail has a mailbox labelled "Archive."  There are literally thousands of email
    in it, probably a copy of every email for many years.  What would happen if I
    deleted these?

    If it is a Gmail account, that is normal. How do you expect Google to exploit your privacy if they let you just delete your emails willy nilly?
    GGmail isn't a normal IMAP server. It's not really an IMAP server at all; it just pretends to be one.
    Instead of organizing messages into folders, it tags messages with "Labels." A message can have multiple Labels. By default, a new message comes with an "Inbox" Label and an "All Mail" Label. When you "delete" an email from GMail, it merely removes the "Inbox" label, but keeps the "All Mail" label.
    When Apple revamped Mail, it made it more capable of working with GMail. One of those things was to map the "All Mail" label to the Archive folder in Mail. Now you can see how Google has kept all of the email you thought you were deleting.
    Take a look at this article and the follow up article it links to: http://jeffschuette.com/2012/03/07/setting-up-apple-mail-to-rock-and-roll-with-g mail/
    I used it to set up Mail and GMail so that when I delete an email in Mail, it also deletes it from the GMail server.
    Most ost of the firat article is no longer needed, except the step to force deletion of emails.

  • What would happen if site to site conference call using G.729

    conference bridge I am currently using is software conference , I am aware that Cisco software conference bridge only support G.711. and my project is a multisite project and site to site calls are via wan not PSTN. so my question is what would happen if a site to site add hoc or meet me conference call is made based on G.729. it doesnt work at all or there are some alternatives. I appreciate any input, thank you in advance

    The main problem is that you will need some xcodes or MTPs in order to use the Software conf bridge, but be aware that using G.711 conf through a WAN link will decrease the available bandwidth and it might fail, for instance, G.711 uses 80 kbps, rather than G.729 that uses 24 (3 G7.29 calls per 1 G.711).
    Here is the codecs' bandwidth utilization:
    - G.711 call uses 80 kbps
    - G.723 call uses 24 kbps
    - G.729 call uses 24 kbps
    - GSM call uses 29 kbps
    - Wideband call uses 272 kbps
    At this point the only option that you have is to get an HDV module and some DSPs and configure a HW xcode and conf bridge.

  • What would happen if I reformatted?

    My computer has been having many issues since FiOS triple play was installed.  Also still have resolved IHA only showing internet and not TV and phone like it should.  So I was wondering what would happen if I reformatted my computer?  Would I lose anything?  Is there a file someone can direct me to incase I lose the driver to the router in process? 
    Also, another option is to uninstall everything verizon that is currently installed.  Thinking previous DSL information on my computer might be the culprit, but since I don't know what files belong to DSL and what files belongs to FiOS I figured I'd just remove everything verizon and start fresh.  
    What program/information does the Installation Tech use when installing FiOS in your home that's on that little white jump drive?

    I actually uninstalled/removed/deleted any and all reference to Verizon, IHA, and VZ in my computer files(that I could find and recognize as verizon files).  Then went to activate my FiOS.   Now, In Home Agent actually shows my TV and Phone as well as my internet(it would only show internet).  So I believe my guess was right that previous Verizon DSL files that remained on my computer were interfering with In Home Agent.    I'm pleased to have fixed the issue.    I have this "Resume FiOS activation" icon on my desktop that won't go away, no matter how many times I click it and apparently finish the activation.   And In Home Agent keeps asking me to update to the newer version.  I click yes, it reloads, asks again, click yes, reloads, asks again.   So I just click no.    Also In Home Agent keeps telling me that my password is incorrect.   I'll change it, the program will automatically insert the NEW password into the box, and it will say it's incorrect again.   Eish!  I want to bang my head against a wall right now! 
    Also, Verizon.com under my services still shows that my set top boxes are not activated,  and any widgets I try to apply don't show up on the TV.  As well as it only gives me the option of adding widgets to one STB, and not the other two.  As in, only one of my three STB's in the drop down box.  
    This all is prett silly as far as I'm concerned.   A lot of bugs and kinks in the system and no one at Verizon seems to know how to fix any of it.   I love the faster more reliable internet, more reliable TV, more phone features than I had for one price comparable to all three as separate services(Dish, DSL, Home phone).  But I am not in love with the technical problems for which there are no answers.  From anyone.    Thinking Verizon's going to have to up the ante to compensate for all the headaches that have been caused by technical problems.  Like a lower price.  I think I deserve a couple people's hourly wage for figuring out what 3 support techs couldn't. 

  • What would happen if you connected audio out to audio in?

    the audio in/out ports on the back -- what would happen if you connected them? if i were, say, playing a youtube video and had an audio editing app open, would it record the audio? (yes, i'm aware that there are better ways to capture said audio but i'm just wondering if this is what would happen.) or would the computer explode?
    Message was edited by: MontereyMatt

    There should not be any problem with doing that. The audio output is just regular output, so it would be the same as plugging in an iPod to the audio input.
    But as you said, there are better ways to record the audio the iMac is currently playing.

Maybe you are looking for

  • ABAP Runtime Error at the time of saving of Document Through CV01N tcode

    Dear Experts We have install seprate DMS Server for storing various documents of different module. While saving of Document through Transaction CV01N one small screen gets pop up.Which is as follows Check in Document:KPro Storage Category   Descripti

  • MacBook Pro 13" late 2011 sound not working.

    There is no red light in the headphones input, nor anything I can do with sound and MIDI. It says that I use my internal speakers. Despite this, the startup sound does still function. Any help I could get would be very appreciated!

  • Unknown Error (-54)

    When I sync my iPod Touch (7.1.1) via iTunes (11.2) I keep getting this error. I understand it means that files are locked. I am running Windows Vista. How do I find out which files are locked, either through iTunes or the command prompt (cmd)?

  • Using fileReamd + custom realm w/ WLS6

    Hi, I would like to write a custom realm for WLS6.0, but I would like to delegate to the fileRealm for WebLogic accounts, such as 'system'. Can anyone suggest a straightforward way to accomplish this? Thanks, Dhiren Dhiren Patel -- Sr. Web Architect

  • ICal and Time Zone

    I have a problem with iCal. In iCal time zone shows as a "CENTRAL EUROPEAN TIME" which is wrong. There is the an option to change (Other) that but it does change anything. When i try to change it goes back to "CENTRAL EUROPEAN TIME" again. On the oth