Jdbc bean errorpage - select - update

i got a problem getting the errorhandling from a bean- i would like to open an errorpage from the bean when the executeupdate function fails - maybe due to an allready existing value
if i move thedb access into a normal jsp i can declare a
<%@page errorPage="errorpage.jsp" %>
but how can i manage that within the bean ? - or should i put all the code into a jsp without trying to fit into the mvc modell ?
import java.sql.* ;
public class DbBean {
   private Connection con;
   private Statement st;
   private ResultSet rs;
   private Statement statement;
   public DbBean() {
     try {
       Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
       con = DriverManager.getConnection("jdbc:odbc:konten");
     catch (Exception e) {
       System.out.println("Fehler bei Verbindung zur Datenbank");
   public ResultSet get(String query) {
     try {
       st = con.createStatement();
       rs = st.executeQuery(query);
     catch (Exception e) {
       System.out.println("Fehler bei Datenbankabfrage" + e.getMessage());
     return rs;
   public void insertData(String query) {
     try {
       st = con.createStatement();
       st.executeUpdate(query);
     catch (SQLException sqle) {
       System.err.println(sqle.getMessage() + " !! Fehler beim InsertVersuch !!");
     catch (Exception e) {
       System.out.println("Fehler bei Datenbankupdateversuch" + e.getMessage());

Well in order for the error page to come up, you have to give the jsp page an exception.
Right now you are just catching the exception, printing a message, and continuing as normal.
You will probably want to rethrow the exception so that it trickles down to the jsp where it can explode into a glorious error page.
Cheers,
evnafets

Similar Messages

  • Execution time difference between SELECT & UPDATE statement in JDBC Sender.

    Hi Experts,
    In my scenario, I have used the JDBC Sender Adapter with the SELECT and UPDATE statement.
    Now the problem is in between the execution of Select and update statement, few more entries are coming in the same DB Table.
    So result of this is updation take place for those entries which are not even picked up by the select statement.
    Can we avoid this execution time difference between the SELECT & UPDATE statemet on JDBC Sender side???
    Thanks & Regards
    Jagesh

    Hi
    Use serializable option in additional parameters, now all new entries would also be updated.

  • Sender JDBC Adapter Select/Update Issue

    Dear All,
    We have configured a Sender JDBC Adapter to Poll data from the DB2 tables. It is working fine and both the select and the update queries written are also getting properly executed and are changing the status of the flag from Y to N once read from database.
    In the communication channel ->
    select * from <table> where flag = 'N'.
    update <table> set flag = 'Y' where flag = 'N'.
    But I have one doubt after executing the select query some new data comes into the table of status flag 'N"., then will this unselected data will also be updated to 'Y' .
    The question is while we do a select and update from XI on the DB table and at the same time there is an insert happening into the table from the other end how will the adpater behave in this case.Will it result in missing of some records during next select/update transaction from XI..
    Your inputs will be appreciated.
    Regards
    Amit

    Amit
    Did you ever get a solution to your question ?
       Sender JDBC Adapter Select/Update Issue  
    Posted: Apr 24, 2008 2:29 PM           Reply 
    Dear All,
    We have configured a Sender JDBC Adapter to Poll data from the DB2 tables. It is working fine and both the select and the update queries written are also getting properly executed and are changing the status of the flag from Y to N once read from database.
    In the communication channel ->
    select * from <table> where flag = 'N'.
    update <table> set flag = 'Y' where flag = 'N'.
    But I have one doubt after executing the select query some new data comes into the table of status flag 'N"., then will this unselected data will also be updated to 'Y' .
    The question is while we do a select and update from XI on the DB table and at the same time there is an insert happening into the table from the other end how will the adpater behave in this case.Will it result in missing of some records during next select/update transaction from XI..
    Your inputs will be appreciated.
    Regards
    Amit

  • SELECT,UPDATE, DELETE With JDBC Adaptor

    Dear All,
    I need to execute few Select, update and Delete statement by using JDBC Adaptor.
    Suppose While select statement no records selected.
    During Update no records exsist with specified key so no update possible.
    During delete if no record found with specified key so no deletion possible.
    In above cases do I get any error, any where in XI . Either in SXMB_MONI or in RWB.
    Regards,
    Raghvendra

    Hi
    You will be getting SQL error in RWB and not processed flag in SXMB_MONI
    Along with this you can use OS level command STDOUT and STDERR to write out the trace.
    using JDBC you can even use following Isolated setting.
    ·        Default (default setting of the respective database)
    ·        None
    ·        read_uncommitted (weakest setting)
    ·        read_committed
    ·        repeatable_read
    ·        serializable (strongest setting)
    You must only lower the isolation level where necessary and as far as necessary. To avoid data inconsistencies in the database when the isolation level is lowered, ensure that multiple database transactions cannot access the database simultaneously.
    With this Do not set Auto Commit enabled indicator if the JDBC driver supports transactions.
    Thanks
    Gaurav Bhargava

  • Sender JDBC: help to construct Update statement

    Hi,
    I need help in writing a update statement to DB2 database in sender JDBC adapter.
    The sender adapter picks up only few records say 10 at a time which match the Select query condition. So I would need to update only those selected "n" records and not all the records that match the Select query condition.
    Select looks like :
    Select * from <table> where <condition> fetch first <n> rows only.
    But it is not allowing the following update
    update <table> set <field> = <value> where <field> IN (Select * from <table> where <condition> fetch first <n> rows only)
    The above statement errors because DB2 does not allows u201CFetchu201D statement within the update sub query.
    Any pointers to a write update statement for n records is highly appreciatedu2026
    ~SaNvu2026

    Hi Santosh,
    In JDBC Sender Adapter provide the following select & update statements
    Select Statement:
    select * from <table> where <condition> AND ROWNUM<N (N==No.of Rows)
    Update Statement:
    update <table> set <field> = <value> where <field> IN (Select * from <table> where <condition> AND ROWNUM<N)
    (N==No.of Rows)
    And for the error you are facing is because of the server communication link failure between the two systems.
    Check the connections and try to stop & start communication channels once.
    Regards
    Venkat Rao .G

  • Jdbc - beans

    hy
    jdbc: here are some new features added that are very fine for GUI applications, as I assume. making a ResultSet scrollable and updatable. I assume the feature Updatable was introduced for GUI applications, make changes in the UI take affect right to the database.
    beans: beans can be bound to database tables, if I understood it right
    when using new functionality of resultSets then no SQL-statements have to be created by the programmer, and i don't have to think about it (simply said).
    as I saw in the NetBeans preview the same is for beans
    can someone please explain me the difference from jdbc and beans? which technology is better for GUI applications? especially performance differences if someone has experience with it
    thanks in advance

    Java Beans and JDBC have both been around since JDK
    1.0. There's nothing new. I haven't ment that those are new, but new features added
    ResultSet can be
    scrollable and updatable, but that depends on the
    vendor who implements your driver.thanks, so I'm on the secure side if I use beans with jdbc
    Beans aren't bound to tables. You're thinking of VB
    or Seam.hm, then I misunderstood the new features of the coming NetBeans IDE 6.0
    thanks for your fast and helpful answer

  • I just updated my iPhone 4 to iOS6.  In the process, I ran into a problem and had to restore factory settings.  After syncing the phone, I see that 218 apps need to be updated. When selecting "update all," it says "manage local device storage usage." How?

    I just updated my iPhone 4 to iOS6.  In the process, I ran into a problem and had to restore factory settings.  After syncing the phone, I see that 218 apps need to be updated. When selecting "update all," it says "Cannot Download.  There is not enough available local storage to download these items.  You can manage your local device storage usage in Settings."
    How can this be the case when I haven't changed any apps from before updrading to iOS6, and I don't have any music yet on the phone?  Why is it telling me there is not enough local space?

    Hi RileyAvaCadenRiver,
    If you recently updated your iPhone to iOS7, you will need to update iTunes on your computer to iTunes 11.1 or newer for it to correctly recognize the iPhone. You may find the following link helpful:
    Apple: iTunes 11.1.1
    http://support.apple.com/kb/DL1614
    Regards,
    - Brenden

  • When my iPod Touch is connected to my Mac, and I select Update to update the software of my iPod Touch, I get a message saying that my iTunes software is current, but it will not update my iPod Touch software.  Is there a bug in the iPod program?

    When my iPod Touch is connected to my Mac, and I select Update to update the software of my iPod Touch, I get a message saying that my iTunes software is current, but it will not update my iPod Touch software.  Is there a bug in the iPod program?

    If you have the first gen ipod touch as your information shows, then you would have to buy a software update:
    Purchasing iOS 3.1 Software Update for iPod touch (1st generation)

  • How can I delete apps from the app store? There seems to be every app I have ever downloaded and deleted since I got my phone in 2007. When I go to app store and select update apps there's a menu at the top that says purchased! I would like to delete hist

    How can I delete apps from the app store? There seems to be every app I have ever downloaded and deleted since I got my phone in 2007. When I go to app store and select update apps there's a menu at the top that says purchased and when I select it it shows every app I've ever had! I would like to delete the history please.
    Many thanks

    You cannot.
    The entire point of this is that you can redownload any and all of your past purchases.

  • HT5655 Has Adobe Flash Player been blocked again.  I can download the image and proceed to installing; however, installation of flash prompts me to select update methods.  I cannot select update or not update.  I also cannot click on NEXT.

    Has Apple blocked Flash Player again, listing it in the block list.  I am able to download the image from Adobe, and begin the install process.  Once I get to the option to select update Flash automatically or not, I cannot select an option or click on NEXT to finish the installation.  Thoughts?

    Adobe's Flash Player Install Manager was updated about a week ago.
    I suggest trying the download from Adobe's site here:
    http://get.adobe.com/flashplayer/?promoid=JZEFT

  • Keep getting error: None of the selected updates could be installed. An unexpected error occurred. Please help!

    Hey I am kind of new to this forum situation, but I keep trying to install software updates on my macbook for the last two weeks and the aforementioned error (None of the selected updates could be installed. An unexpected error occurred.) keeps resulting. I would download them straight from online, but I don't know which ones to download. What should I do?

    Bring up Software Update, and when it says it has updated software to download, click the button on the left bottom of the window, might say something like show details. That will open the box to show you exactly what would download. You can then visit the Apple download site at http://support.apple.com/downloads/

  • HT1689 can't get itunes updates on ipad, but can get everything else...genius, purchases, etc. When I select "updates" screen is blank.  Any ideas??

    Can't get itunes updates on ipad, but can get everything else...genius, purchases, etc. When I select "updates" screen is blank.  Any ideas??

    The update server is down; try this temporary workaround
    App Store>Purchased>Select "All"
    Note: Look out for apps that have the word "Update"
    http://i1224.photobucket.com/albums/ee374/Diavonex/9c256282736869f322d4b3071bbb2 a82_zps51a6f546.jpg

  • Making  Statistics to Discover the use % of Select/Update/Delete

    Hi,
    I have a small database, and I'd like to do a Statistics about the use of Select/Update/Delete. I hear about two ways.
    1-) Using Audit
    2-) Reading the Archives though package DBMS_LOGMner
    What way do u suggest to me ?
    If anyone have links and more information how I can do this statistics, could post it here ?
    Thank you.
    Fernando.

    2-) Reading the Archives though package DBMS_LOGMnerWell, if the database is not in archivelog mode, you can only read the online redo logs, therefore, missing the historical information.
    The best and simpliest solution to implement auditing.
    Jaffar
    Message was edited by:
    Syed Jaffar

  • JDBC Bean for JSP

    Any JDBC beans available for JSP? I know regular JDBC can be used but putting database connection logic in jsp sort of destroys its purpose. Are any beans in the works? Freeware/OSS beans?

    Yes, we are working on some JDBC-based beans to facilitate database access. Ours is not available yet, not sure about other freeware.

  • Admin gets the following message while trying to update software: None of the selected updates could be saved. A network error has occurred. Check your Internet connection, and then try again. Any suggestions?

    I'm the Adnin. just recently I tried to update system software (Lion OS). The following message was returned. None of the selected updates could be saved. A network error has occurred. Check your Internet connection, and then try again. but I have internet access )email, Safari, etc.). Any idea of what is happenening?

    The error may be at Apple's end rather than yours. It could also be due to corrupted files on your computer. Try deleting the following:
    /Home/Library/Preferences/com.apple.SoftwareUpdate.plist
    /Home/Library/Caches/com.apple.SoftwareUpdate/
    /Library/Preferences/com.apple.SoftwareUpdate.plist
    Restart your computer.

Maybe you are looking for

  • WRT54G with PS3 NAT TYPE 3 needs to be changed!

    Hi all, I've been trying to change my Nat type from a 3 to a 2. I have a ps3 20gig (sadly) that is directly connected to my laptop (wired). My laptop has wifi and I'm able to play games online. The only problem is that I'm not able to invite friends

  • ITunes 9.2 won't start - 13014 error

    Just installed itunes 9.2 update and get "The iTunes application could not be opened. An unknown error occurred (13014)". I had installed all available iTunes updates before. My MacOS version is 10.6.3. (installed it back after 10.6.4 upgrade because

  • Replacing Music After Hard Drive Failure

    I just got my computer back from the repair place after its hard drive failed. I had my music collection (purchased through iTunes) backed up on CDs, and I'm in the process of putting it back on my computer. The music is downloading fine, but the com

  • Not updating songs

    I have a 3rd Generation 15 GB iPod and I haven't used it for about a month. After I charged it, I tried uploading the new songs I have on my iTunes. For some reason, it doesn't detect it. I mean, it starts charging when it's connected, so obviously e

  • Get image of Data Type of wire

    Hello,  I know how to return the image of a front panel or diagram using VI server however I'm looking to be able to return the same image as displayed within the 'Data Type of Wire' information in the Context Help window when I hover my mouse over a