How to extract from the exception the reason for the failure

I have a method that executes an sql update and fails.
The description of the failure is:
com.ibm.websphere.ce.cm.DuplicateKeyException: One or more values in the INSERT statement, UPDATE statement, or foreign key update caused by a DELETE statement are not valid because the primary key, unique constraint or unique index identified by "1" constrains table "XXX" from having duplicate rows for those columns.
I didn't find a way of extracting the type of the exception (if there's one).
I want to be able to assess the exception and to return a specific error message with
the specific error explained.
thanks
Itamar

One can alway catch the exceptions (java.sql.SQLException) and call its getErrorCode() method,
but getMessage or getLocalizedMessage are fine also.
In your case you have primary fields or indexes that require uniqueness of some fields across records.
For instance if you have a composed primary key id+language and forget to INSERT the language.
Off course you find the spot in the code by:
try {
} catch (....Exception e) {
    e.printStackTrace();
}Another preventive way is to use PreparedStatements.

Similar Messages

  • NPD Metrics - how to extract from the database in a usable format

    Metrics for NPD activities and projects are stored in the database one row for each metric in each activity or project instance. If there are multiple metrics per activity instance, for example, extraction of those metrics yeilds only a list of metrics and values. I'd like to see it in more of a table style output. Can you provide some guidance on how to extract this from the DB using sql? Thx

    Here is the SQL that should help understand the structure. There are a few ways to pull this data in more of a column based approach. This should help you get started.
    select modml.baseName as MetricName, bases.name as Basis, ph.name as Phase,
    fy.name as FiscalYear, gl.Value as Value, UOM.ID as UOM, currml.Name as Currency
    from plmFieldExchangeGlobals gl
    inner join plmFieldExchangeDefinitions fed on fed.pkid = gl.FieldExchangeDefinitionPKID
    inner join plmFieldExchangeDefModels mod on mod.pkid = fed.fkFieldExchangeDefinitionModel
    inner join plmFieldExchDefinitionModelML modml on modml.fkFieldExchangeDefinitionModel = mod.pkid and modml.langID = 0
    inner join plmFieldExchangeBases bases on fed.fkFieldExchangeBasis = bases.pkid and bases.langID = 0
    inner join plmFieldExchangePhases ph on fed.fkFieldExchangePhase = ph.pkid and ph.langID = 0
    inner join plmFieldExchangeFiscalYears fy on fed.fkFieldExchangeFiscalYear = fy.pkid and fy.langID = 0
    left outer join UOM on UOM.pkid = mod.fkCommonUOM
    left outer join commonCurrenciesML currml on currml.fkCurrency = mod.fkCommonCurrency and currml.langID = 0
    where ProjectPKID = '320219992047-072a-4698-a553-de5ec124ff9c';
    Segal

  • How to record from the video in or S-video Ports on Qosmio G40?

    Can anyone tell me how to record from the video in or S-video ports, because i've tried the Ulead DVD factory program and the only capture device it could see was the webcam, and it did capture from it
    After that i've downloaded the update file that was provided by the support website
    The devices that the program could see are the TV tuner and the webcam (which it couldn't access anymore for some reason)
    After that i've downloaded a newer update which simply is the same as the last update and seems that someone in the support website directed the link of the new update which they don't have to the file of the previous update which doesn't really do anything.

    Hi
    There are 2 s-video ports; s-video out port is not designed to capture the signals from any external source. The name of this port says everything; its an OUT port!
    The s-video-in port must be placed at the right side of the notebook. Dont mix the both ports. But note; this port receives only the video signals. To hear the sounds, use a video cable to connect the sound terminals of the audio device and your computer.
    Red: sound right channel
    White: sound left channel
    The Ulead DVD Movie factory can be used to capture this signal.

  • How to query from the xml table a single, specified element.

    I'm quite new in Xml Db. Pleas, can anybody tell me how to query from the xml table below a single element (i.e. the element 'rapportoparentela = NIPOTE' related to the element 'codicefiscale = CRRVNC76R52G337R', or the element 'rapportoparentela = FIGLIO' related to the element 'codicefiscale = CRRRNT51L23G337Q')?
    - <dati xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <codiceinterno />
    <codicefiscaleassistito>CRRMNL81R31G337H</codicefiscaleassistito>
    - <famigliare>
    <codicefiscale>CRRVNC76R52G337R</codicefiscale>
    <rapportoparentela>NIPOTE</rapportoparentela>
    </famigliare>
    - <famigliare>
    <codicefiscale>CRRRNT51L23G337Q</codicefiscale>
    <rapportoparentela>FIGLIO</rapportoparentela>
    </famigliare>
    - <famigliare>
    <codicefiscale>CBRPRN15S65E080W</codicefiscale>
    <rapportoparentela>I.S.</rapportoparentela>
    </famigliare>
    - <famigliare>
    <codicefiscale>CRRMNL81R31G337H</codicefiscale>
    <rapportoparentela>NIPOTE</rapportoparentela>
    </famigliare>
    - <famigliare>
    <codicefiscale>BCCCML54C50I845G</codicefiscale>
    <rapportoparentela>NUORA</rapportoparentela>
    </famigliare>
    </dati>
    Using SELECT extractValue(value(t),'/rapportoparentela') into result FROM NF_XMLT X,
    TABLE ( xmlsequence (extract(value(X),'/dati/famigliare/rapportoparentela'))) t
    I get all the elements 'rapportoparentela' and I want to get only one specified.
    Regards.
    Piero

    Piero,
    you can add the condition "CRRVNC76R52G337R" to your xpath-expression like:
    SELECT extractValue(value(t),'/rapportoparentela')
    FROM NF_XMLT x
    ,TABLE ( xmlsequence (extract(value(X),'/dati/famigliare[rapportoparentela="CRRVNC76R52G337R"]'))) tto select only those famigliare-elements that have a child-element rapportoparentela with value "CRRVNC76R52G337R".
    When you stored your XML in an XMLType column in the table, i think the following queries are better:
    SELECT extractValue(x.your_XMLType_column,'/dati/famigliare/rapportoparentela')
    FROM NF_XMLT x
    WHERE extractValue(x.your_XMLType_column,'/dati/famigliare/codicefiscale')
    = 'CRRVNC76R52G337R'or
    SELECT extractValue(x.your_XMLType_column,'/dati/famigliare/rapportoparentela')
    FROM NF_XMLT x
    WHERE existsNode(x.your_XMLType_column,'/dati/famigliare[codicefiscale="CRRVNC76R52G337R"]')
    != 0

  • [svn:fx-4.x] 15186: In RichEditableText handlePasteOperation() if there are no constraints (maxChars, restrict or displayAsPassword) and multiline text is allowed we can do an immediate return before the text is extracted from the text flow .

    Revision: 15186
    Revision: 15186
    Author:   [email protected]
    Date:     2010-03-31 16:42:19 -0700 (Wed, 31 Mar 2010)
    Log Message:
    In RichEditableText handlePasteOperation() if there are no constraints (maxChars, restrict or displayAsPassword) and multiline text is allowed we can do an immediate return before the text is extracted from the text flow.  This should be the typically case when pasting large amounts of text.
    QE notes:
    Doc notes: None
    Bugs: partial fix for SDK-25793
    Reviewed By: Gordon
    Tests run: checkintests
    Is noteworthy for integration: No
    Ticket Links:
        http://bugs.adobe.com/jira/browse/SDK-25793
    Modified Paths:
        flex/sdk/branches/4.x/frameworks/projects/spark/src/spark/components/RichEditableText.as

    Step by step, how did you arrive at seeing this agreement?

  • How to extract all the list of reports names available in the WEBI public?

    can anyone please help me how  to extract all the list of reports names which are available in the WEBI Public folder?
    I ran the VB macro downloaded from net but that is extracting all crystal,deski & webi reports..
    but i want only webi list of reports..
    Please help me to achieve this?
    Thanks
    Radha

    Is this about Business Objects WEBI? You might want to post in the BOBJ forums instead.[BOBJ Forums|/community [original link is broken];

  • Problem in extracting from the import transport set

    i am exporting all of the major page groups and providers from my source box to the target machine. both are using the same version database, app server and portal version 904.
    for one of the biggest provider, i created transport sets in the export system, ran the script for NT to create a dump file. moved dump files to the import system, imported its transport set from this file. now i am trying to extract the imported transport set.
    here i am facing problems one after the other.
    1. first is this that this extraction from the import transport set is costing too much time. more than 36 hours have already passed and it has not finished.
    2. it does seem to populate though as after several hours i see the log file with its lines showing a message like .... 'importing component ... so and so ... '. however, the whole process is not finishing or going fast. there is no other process running on this target box.
    3. and surprisingly, the log files update the start time of the script every few hours.
    can somebody please help? this is a very time-sensitive request.
    thanks.

    Hi,
    if i remember exactly i thought this error due to field selections in R/3 whatever the fields u have given in selection tab in rsa3 in ECC give the same selections while scheduling the infopackage than u can able to see the records in psa for full load.
    after doing dis still problem persists revert me.
    Regards,           
    shiva                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         

  • I am a brand new mac user...trying to figure out how to switch from the Mac Pro screen to my external monitor.  Appreciate any help.

    am a brand new mac user...trying to figure out how to switch from the Mac Pro screen to my external monitor.  Appreciate any help.  thanks

    In Finder... goto Help... In the Search Window type in Displays...
    Lots of Useful Information there...
    You may find these Links Useful too:
    http://www.apple.com/support/mac101/
    http://www.apple.com/support/macbookpro/
    Cheers,

  • How to exit from the button test in diagnostic mode

    Hi,
    I am having some trouble with my ipod 7th gen.
    First my lightning cable wont be recognize. show the error Accesory incompatible.
    I try to solve the problem cleaning the golden pins in the cable and in the ipod. Don't work
    I enter in diagnostic mode in my ipod and I get stucked in the button counter test..
    In the screen appear a mesage 'Please reset the unit to end'. I don't know how to reset the unit
    I press any button and only increase the counter for every button.
    First how acan exit from the button counter test and how can fix the issue with the lightning cable

    Your problem is that you are trapped inside an event case. It is not a good idea to run extended code inside event cases, else the event structure cannot service other events.
    Why don't you use the outer loop for everything? Now things don't step on each others toes. What good is an event structure if it cannot react at all times???
    Message Edited by altenbach on 07-25-2008 12:26 AM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    event_problemMOD.vi ‏17 KB

  • How to upgrade from the current Photoshop Photography Program to the full Creative Cloud student?!

    How to upgrade from the current Photoshop Photography Program to the full Creative Cloud student?!
    In the account section it just gives me a full version (the one for 65€)

    Start here https://creative.adobe.com/join/edu
    One Year Intro Price http://forums.adobe.com/thread/1448933?tstart=0
    http://www.adobe.com/products/creativecloud/students.edu.html
    http://www.adobe.com/products/creativecloud/buying-guide-education.html
    http://www.adobe.com/education/students/student-eligibility-guide.edu.html
    ID Proof http://www.adobe.com/store/au_edu/academic_id.html

  • HOW TO DISCONNECT FROM THE INTERNET WHEN TRAVELING INTERNATIONAL

    HELLO EVERY ONE.I RECENTLY TRAVELED TO CANADA,WHEN I RETURNED BACK HOME I RECIEVED AN $1800 CELL PHONE BILL,$1000 OF THE BILL WAS INTERNET USAGE,I ADD AN INTERNATIONAL FEATURE BEFORE I LEFT BUT IT WAS LIMITED (HOW DO YOU CHECK HOW MUCH USAGE YOU HAVE USED WHILE BROWSING).SO I ASKED AT&T/A GUY IN THE APPLE STORE,BUT NO ONE REALLY KNOW HOW TO DISCONNECT FROM THE INTERNET AFTER USING IT,WHEN TRAVELING INTERNATIONAL.(MY TREO HAD AN OPTION THAT ASKED DO YOU WANT TO DISCONNECT FROM THE INTERNET)(THE IPHONE DON'T)

    If you have upgraded to version 1.1.1 or later there is a switch to disable cellular data while roaming. By default it is set to disable data. Settings/General/Network Data Roaming.
    You can monitor cellular data usage in Settings/Usage. Reset it just before traveling.

  • How do I fix the failure to read Pdf files?

    How do I fix the failure to read Pdf files(Many old and some new) with new acro reader 11?

    What is your operating system?  What exactly do you mean "failure to read"; do you get an error message?

  • Can anybody tell me how to extract sales value and cost value for an materi

    dear all,
    Can anybody tell me how to extract sales value and cost value for an material sold .
    All the values of cost value and sale values are getting  stored in bseg-wrbtr field .
    How to identify them uniquely.
    Or there is another way to find the sale and cost values.
    Regards
    Mave

    Hi Mave!
    Normally there is no condition change, when something is sold.
    But sales price depends on sales conditions (not only price, but also surcharges, discounts, taxes - if customized).
    Nevertheless, after selling you have a invoice document, where correct values <i>should</i> be stored (see VBRP fields mentioned above). If here is a problem, then customizing of price determination is in question, not a programming of user-exits with MARD selection for costs (or some other tries to get a price).
    When you specify your requirements more in detail, you might get better answers - but currently only general hints are possible ('see in invioce / G/L accounts').
    Regards,
    Christian

  • How to extract/format the calendar week from date?

    Hi,
    we are using WebI XI 3.1 SP3 in combination with SAP-BI(BW) 7.2.
    From a BW-Query we get a normal date (21.03.2011) and we want
    to show our KPIs/ key data per calender week (12.2011).
    In the universe-designer we only can get calender month from a calender day
    (right click to the dimension --> object format --> Date/.. --> Mmm jjjj).
    So the question is, HOW CAN WE GET THE CAL WEEK within SAP-BO (Universe/WEBI)?
    Thanks for help.

    Hi Tim,
    Can't you use the Week() function in Webi for this? It will return the week of the year as a number.
    Thanks

  • How I can extract from the table KONM?

    Hi Experts,
    I need to extract information from the table KONM.
    Somebody know any standard extractor?
    Thanks a lot!

    Hi Leticia,
    I think SAP does'nt deliver any standard extractor or Datasource related to the table KONM. The datasources delivered by SAP and related to the pricing are 2lis_11_VAKON and 2lis_13_VDKON but linked to the table KOMV.
    In your case you have to create a generic datasource using the T-Code RSO2 and you link it to the table KONM with a View, Infoset query or a function module.
    Regards.
    Yacine

Maybe you are looking for

  • Updating and Loading a  Matrix Row with Mix of DB and Non DB fields

    Hi I'm using SAPB1 2005 SP1 PL14 with B1DE 1.3 I have a matrix on a form that was generated by the UDO Form Generator. The Matrix contains data associated from a Document Lines table. The underlying table and (therefor the matrix as well) only had 1

  • How do I update Firefox to a version other than the latest one?

    As you can see from the troubleshooting information, I am several versions behind the latest Firefox. I am wondering whether an update would make Hotmail work on Firefox again and make it faster. However, Firefox Auto Updater is set to install the la

  • Software download failed n96

    hi all,i cannot load some software from the disc or from nokia downloads. n series system utilities and nokia software updater fail to load.running vista, any ideas would be appreciated thanks

  • Code for AP Invoice Payment Block and Blocking Reason

    What is the best way to code unblocking of Accounts Payable Invoice - using FM FI_DOCUMENT_CHANGE, BDC or direct table update. Also, i need to remove blocking reasons for MM documents. I am not sure what table this is stored? Are there any FMs that c

  • Urgent please: Master-Deatils OAF Page for enter and Update data

    Hi all, i need your help to build master-details oaf page for Enter / Update data for example: We have Locations , Department , Employees tables all these tables on one oaf page (OAAdvancedTable) when user enter New Location and go to Enter it's Depa