How to make jdbc code thread safe

Iam using jsp to connect to the data base how to make it is thread safe

ch.vasu07 wrote:
Iam using jsp to connect to the data base how to make it is thread safeYou should not be connecting to a database in a JSP. Do that on the server side. JSPs should be pure view.
Learn JSTL and keep scriptlet code out of your JSPs.
%

Similar Messages

  • How to make the main() thread wait?

    I would like to know how to make the main() thread wait for another thread?If I use wait() method in main() method it says "non-static method wait() cannot be referenced from a static context",since main()
    is static.

    Here is an example how you may wait for a Thread in the main -
    but be careful, this is no real OO:
    public class WaitMain {
    // this is the thread class - you may also create
    // a runnable - I use a inner class to
    // keep my example simple
         public static class ThreadWait extends Thread{
              public void doSomething(){
                   synchronized(syncObject){
                        System.out.println("Do Something");
                        syncObject.notify();
              public void run(){
                   // sleep 10 seconds - this is
                   // a placeholder to do something in the thread
                   try{
                        sleep(10000);
                        doSomething();
                        sleep(10000);
                   catch(InterruptedException exc){
    // this is the object we wait for -
    // it is just a synchronizer, nothing else
         private static Object syncObject = new Object();
         public static void main(String[] args) {
              System.out.println("This will start a thread and wait for \"doSomething\"");
              ThreadWait t= new ThreadWait();
              t.start();
              synchronized(syncObject){
                   try{
    // this will wait for the notify
                        syncObject.wait();
                        System.out.println("The doSomething is now over!");
                   catch(InterruptedException exc){
              // do your stuff

  • How to make reason code compulsory while processing F-53

    Hi Boss,
    Can u plz. tell me How to make reason code compulsory while processing F-53. this is because I have defined differnet reason code and one is having blank text.
    Thanks
    S

    hi,
    Just check this one dont check previous one....
    goto TCODE OBC4 and then click on ur company FELD status variant and double click on field status group ....
    Then click on G067 RECONCILTION ACCOUNTS and then double clickn that in that and then click on payment transactions and then select REASON CODE AS REQUIRED.
    ur problem will solve...
    if useful assign points
    regards,
    santosh kumar

  • How to make JDBC and SAP connectivity with VC 6.0

    can anyone help me.....how to make JDBC system and SAP system visible in the System drop-down list in Data Task Panel of Visual Composer 6......i mean how to make connectivity with JDBC and SAP system......so that i can use any table in the back-end database as well as any BAPI in the R/3 system.........
    Thank you very much.....

    Hi Deep,
    There is a how-to posted on SDN regarding how to connect and configure the BI JDBC Connector.
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/uuid/6209b52e-0401-0010-6a9f-d40ec3a09424
    This document describes the jdbc driver to use etc.
    Hope this helps,
    Cheers,
    Scott

  • How to make tax codes in mm purchasing

    Dear Guru,
    1. How to make tax code for purchase of Raw materials with basic excise duty=14%, SECess=2%, HSEcess=1% and Additional Excise duty=4% as follows . If we consider basic prise=100 then
    BASIC                  =100
    BED    (14%)        =14
    SED     (2%)        =0.28----
    Sed=secondary Educational Cess
    HSECESS (1%)     =0.14
    SUB TOTAL        = 114.42
    AED (4%)           =4.56
    TOTAL             = 119
    For above all taxces(BED,SED,HSEcess,AED) , client gets 100% set off.
    Please tell me detail procedure.
    2.Do we need to assign (tax code)  them to any business area, as my system is giving an error at the time of saving in MIRO.
    3. What is the meaning of ticking ( check box tick) for calculate taxes under  basic tab in MIRO.

    Hi Nitin,
    Tax Set Off depends on the Account Key which you are using. Account Key in Tax Procedure will be defined by finance at SPRO - Financial Accounting - Financial Accounting Global Settings - Tax on Sales / Purchases -   Basic Settings - Check and Change settings for Tax Processing.
    Check the relevant condition type in the Tax Procedure (TAXINJ / TAXINN), and then check the account key of the procedure whether the Non Deductable indicator is set or not. you may take finance help for the same. Once it is done correctly then define the excise defaults for the relevant tax procedure at SPRO - Logistics General - Tax on Goods Movement - India - Basic Settings - Determination of Excise duty - Maintain Excise defaults
    Then create the tax code with the relevant condition types.
    You need to assign the Tax code to Company code if you use TAXINN procedure. No need for assignment of Tax code to Business Area
    Once you select the Check Box Calculate taxes in MIRO, then system calculates the Taxes based on the tax codes defined and also validates whether Part II Postings have been done or not also for the Excise relevant transactions
    Regards,
    Ramakrishna

  • Anyone knows how to make this code to netbeans??

    anyone knows how to make this code to netbeans?? i just want to convert it into netbeans... im not really advance with this software... anyway..just reply if you have any idea...or steps how to build it... etc.... thanks guys...
       import javax.swing.*;
       import javax.swing.table.*;
       import java.awt.*;
       import java.awt.event.*;
       import java.util.regex.*;
       public class FilterTable {
         public static void main(String args[]) {
           Runnable runner = new Runnable() {
             public void run() {
               JFrame frame = new JFrame("Sorting JTable");
               frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
               Object rows[][] = {
                 {"AMZN", "Amazon", 41.28},
                 {"EBAY", "eBay", 41.57},
                 {"GOOG", "Google", 388.33},
                 {"MSFT", "Microsoft", 26.56},
                 {"NOK", "Nokia Corp", 17.13},
                 {"ORCL", "Oracle Corp.", 12.52},
                 {"SUNW", "Sun Microsystems", 3.86},
                 {"TWX",  "Time Warner", 17.66},
                 {"VOD",  "Vodafone Group", 26.02},
                 {"YHOO", "Yahoo!", 37.69}
               Object columns[] = {"Symbol", "Name", "Price"};
               TableModel model =
                  new DefaultTableModel(rows, columns) {
                 public Class getColumnClass(int column) {
                   Class returnValue;
                   if ((column >= 0) && (column < getColumnCount())) {
                     returnValue = getValueAt(0, column).getClass();
                   } else {
                     returnValue = Object.class;
                   return returnValue;
               JTable table = new JTable(model);
               final TableRowSorter<TableModel> sorter =
                       new TableRowSorter<TableModel>(model);
               table.setRowSorter(sorter);
               JScrollPane pane = new JScrollPane(table);
               frame.add(pane, BorderLayout.CENTER);
               JPanel panel = new JPanel(new BorderLayout());
               JLabel label = new JLabel("Filter");
               panel.add(label, BorderLayout.WEST);
               final JTextField filterText =
                   new JTextField("SUN");
               panel.add(filterText, BorderLayout.CENTER);
               frame.add(panel, BorderLayout.NORTH);
               JButton button = new JButton("Filter");
               button.addActionListener(new ActionListener() {
                 public void actionPerformed(ActionEvent e) {
                   String text = filterText.getText();
                   if (text.length() == 0) {
                     sorter.setRowFilter(null);
                   } else {
                     try {
                       sorter.setRowFilter(
                           RowFilter.regexFilter(text));
                     } catch (PatternSyntaxException pse) {
                       System.err.println("Bad regex pattern");
               frame.add(button, BorderLayout.SOUTH);
               frame.setSize(300, 250);
               frame.setVisible(true);
           EventQueue.invokeLater(runner);
       }

    its okay onmosh.....what we need to
    this...forum....is to have a good......relationship
    of programmers......and to start with .....we need to
    have a good attitude........right.....???.....no
    matter how good you are in programming but if you did
    not posses the right kind of attitude....everything
    is useless.....in the first place....all we
    want....is just to ask...some....help....but
    conflicts......but unluckily......we did not expect
    that there are members in here which......not
    good...to follow.....just as suggestion for those
    people not having the right kind of attidude...why
    can't you do in a very nice message sharing in a very
    nice....way....why we need to put some
    stupid....stuff...words.....can't you live with out
    ******* ****....its not.....lastly especially you
    have your children right now and people around...that
    somehow......idiolize...you even me....is one of
    them......but showing but attitude....is not
    good......tnx....hope you'll take it this....in the
    positive side.....be optimistic...guys....the
    world..is not yours....all of us will just past
    away....always..remember that one.....treasure..our
    stay in this....temporary home.....which...is
    world....Whoa. That post seems to be killing my brain.
    URK
    Join........us..........do not be..........afraid.......

  • Can you explain me clearly how to make company code visible in cost center

    can you explain me clearly how to make company code visible in cost center master data using tcode kmlv

    Hi,
    There is no way to activate the company code field. If your Controlling Area and Company Code have one to one Assignment, then Company code is defaulted from the Controlling Area. However, if multiple Company Codes are assigned to one Controlling Area, then Company Code becomes a mandatory field in the Cost Center master data
    Also, in case you have multiple company codes assigned to one controlling area, please check the setting of the Controlling Area in Configuration and see if have selected "Cross Company Code Cost Accounting" . Also, check if you have assigned all the company codes to the controlling area
    Regards
    Mahendra

  • How to make comnapy code defalut got 100 and 1001 in the PNP screen

    Hi Expart ,
    can u tell me my que how to make comnapy code defalut got 100 and 1001 in the PNP screen in HR reporting?
    Regards
    Razz

    Use the below code in the   INITIALIZATION   
                     INITIALIZATION                                      *
    initialization .
    " Make Default values for Company Code 2100 & 2200
      PNPBUKRS-LOW  = '2100'.
      PNPBUKRS-HIGH = '2200'.
      append PNPBUKRS.
    regards
    .....lakhan

  • Is Oracle JDBC driver thread safe

    Is the Oracle JDBC driver thread safe?

    Seems that this is not totally true.
    We have a Problem with Oracle JDBC driver 9.2.0.5.0 (thin)
    Using an IBM JDK 1.4
    Szenario:
    Thread 1 access to a CLOB via
    ResulSet.getCharacterStream(int)
    Thread 2 normal access via some select and
    ResulSet.getString(int)
    (Both using the same connection)
    The following threads appear to be in a circular deadlock.
    Further information can be found by looking in the Overall Thread Analysis
    section of this tool.
    Multi-threaded deadlock 1:
    "Servlet.Engine.Transports : 6" of (sys:0x39778800) (TID:0x104590D0)
    Holding Resource: oracle.jdbc.ttc7.TTC7Protocol@1ADEB358/1ADEB360
    Thread Waiting: "ProcessNotificationTask" (sys:0x3C51FC18) (TID:0x103B4C40)
    "ProcessNotificationTask" of (sys:0x3C51FC18) (TID:0x103B4C40)
    Holding Resource: oracle.jdbc.driver.OracleConnection@1AE45160/1AE45168
    Thread Waiting: "Servlet.Engine.Transports : 6" (sys:0x39778800) (TID:0x104590D0)
    4XESTACKTRACE at oracle.jdbc.driver.OracleStatement.doExecuteQuery(OracleStatement.java:2667)
    4XESTACKTRACE at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2840)
    4XESTACKTRACE at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:608)
    4XESTACKTRACE at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:536)
    4XESTACKTRACE at com.top_logic.knowledge.service.db.DBKnowledgeBase.getObjectsByAttribute(Unknown Source)
    4XESTACKTRACE at oracle.jdbc.ttc7.TTC7Protocol.getLobChunkSize(TTC7Protocol.java:3050)
    4XESTACKTRACE at oracle.sql.LobDBAccessImpl.getChunkSize(LobDBAccessImpl.java:687)
    4XESTACKTRACE at oracle.sql.CLOB.getChunkSize(CLOB.java:692)
    4XESTACKTRACE at oracle.sql.CLOB.getBufferSize(CLOB.java:717)
    4XESTACKTRACE at oracle.sql.CLOB.getCharacterStream(CLOB.java:345)
    4XESTACKTRACE at oracle.sql.CLOB.characterStreamValue(CLOB.java:1377)
    4XESTACKTRACE at oracle.jdbc.driver.OracleStatement.getCharacterStreamValue(OracleStatement.java:5817)
    4XESTACKTRACE at oracle.jdbc.driver.OracleResultSetImpl.getCharacterStream(OracleResultSetImpl.java:1230)
    It seems that the access to the CLOB needs another,
    internal SELECT to the Database and this way
    TTC7Protocol and OracleConnection lock out each other.
    This only happens on a true multiprocessor machine.
    We tried to reprodcue it on a Single Processor
    and some HyperThreading Machine but had no real sucess.
    Now where can I sumbit this as a Bug ?

  • Is this code thread safe?

    I've been seeing some information that makes me think that some servlet code I have that I thought was thread-safe actually isn't. I have a servlet that takes a POST request and calls a stored procedure on a database to do some inserts.
    public void doPost(HttpServletRequest request, HttpServletResponse response)
      // Check validity of request then proceed.
      if (valid) { postPayment(request); }
    synchronized private void postPayment(HttpServletRequest request)
      /* Take some parameters from the request and call the stored procedure */
    }What I'm attempting to do is ensure that 2 requests with the same data don't attempt to insert to the database at the same time. Have I accomplished that or do I need a different approach?

    Meatwad wrote:
    What if I had a static synchronized java bean that a member variable of the servlet class?As stated in my previous post:
    even that wouldn't be enough if there's more than one server running your app.and
    Since it database operations that you want to make atomic, the right place to ensure that is in the database.and
    The database is the only place where you're guaranteed a shared point of access to the resources you're trying to protect, so that's the appropriate (only) place to provide that protection.For an academic exercise with a single server, and if no other servlet or app is modifying the relevant tables, your approach is probably sufficient. But when all is said and done, a database transaction is the appropriate way to ensure exclusivity and atomicity of database operations.
    EDIT: Now, when you say "java bean", if you in fact are referring to an EJB, then I think they have their own tools and idioms for exclusivity and atomicity that encompass Java level syncing and DB transactions. I'm don't know anything about that though.
    Edited by: jverd on Jun 22, 2011 10:23 AM

  • How to Make Project Code as Mandatory

    Hi ! I Need Project code as mandatory in Po's and Sales Order in Row Level. How to Make that one. Also i have a issue with approved PO's. If some PO got approved is there any option to make amendment and resend for again approval.
    Thanks and Regards
    Kamal

    Hi Kamal.......
    Try this below SP for making project Code Mandatory........
    For Sales Order:
    If @object_type='17' and @transaction_type='A'
    BEGIN
    If Exists (Select T0.DocEntry from ORDR T0 Inner Join RDR1 T1
    On T0.DocEntry=T1.DocEntry
    Where T1.Project Is Null
    And T0.DocEntry = @list_of_cols_val_tab_del)
    BEGIN
    Select @error = -1,
    @error_message = 'Please select Project'
    End
    End
    For Purchase Order:
    If @object_type='22' and @transaction_type='A'
    BEGIN
    If Exists (Select T0.DocEntry from OPOR T0 Inner Join POR1 T1
    On T0.DocEntry=T1.DocEntry
    Where T1.Project Is Null
    And T0.DocEntry = @list_of_cols_val_tab_del)
    BEGIN
    Select @error = -1,
    @error_message = 'Please select Project'
    End
    End
    If your PO is approved and you want to ammend it then your approver has to reject the PO first and it will come to you and then make edition and send it again......
    Regards,
    Rahul

  • How to make a code in which i have to detect 3 objects

    Hello everyone,
    I am new in Labview. I want to make a code in which i have to detect 3 objects and they are in different shapes (rectangle, triangle etc).
    1. How many objects in image.
    2. What is the size of each object in image
    3. At what position they are laying.
    4. Data array of histogram of each object.
    5. What is the color of each object.
    Please help me out. I am confused with the tool. Which tool i will use for this Vision Assistant or Vision Builder AI or if i use labview directly to make the code what steps should follow to make this code.
    Thanks
    Zeeshan

    Hello Zeeshan,
    this is Vanessa, AE from Germany. I really like to help you with your project but like the other members already told you it would be easier if you have a certain problem.
    Using your Shapes.jpg you have several options in the Vision Assistant. For identifiying circular objects of different size the tool "Find circular Edge" from the "Machine Vision" tab is the right choice (see screenshot attached). The result will be the center position and the radius so on. The pattern match function is not the right option because each of your objects has a different shape. In order to use this tool you need several copies of your object.
    Do you really need colored images? For most application it is sufficient to use grayscale images. Be aware that some functions are only available for grayscale and your program will speed up.
    Please tell us more details about your project.
    Kind regards,
    Vanessa
    Attachments:
    vision assistant.PNG ‏305 KB

  • How to make this code go faster?

    Hi,
    I have this code and its really slow. My question is how to make it faster since its taking about 10 hours.
    Code:
      loop at ti_equi.
        select matnr sernr lief_nr kunde datum uzeit bwart posnr
    appending corresponding fields of table ti_ser01
          from z_objk_ser01
         where sernr eq ti_equi-sernr
           and matnr eq ti_equi-matnr.
      endloop.
      delete ti_ser01 where not ( kunde in s_kunnr and
                                  bwart = '631' ).
      sort ti_ser01 by matnr sernr datum descending uzeit descending.
      delete adjacent duplicates from ti_ser01 comparing matnr sernr.
    What this code does is fetch all these fields and then just keeps the one that's been modified at last.
    I have created an index by sernr and matnr in table objk which makes it just a little bit faster.
    Any helpful answer will be appreciated.
    Regards,
    Roberto
    Edited by: Julius Bussche on Jan 27, 2009 4:29 PM
    Code tags added. Please use more meaningfull subject titles

    Hi roberto
    please avoid select statment inside loop.
    use code
    data: index type sy-tabix.
    data : ti-ser011 type standard table of zobjk-ser01 with header line.
    select matnr sernr lief_nr kunde datum uzeit bwart posnr
          from z_objk_ser01 into table ti_ser01.
    sort ti_ser01 by sernr matnr.
    sort ti_equi by sernr matnr.
    index = 1.
    loop at ti_equi.
        loop at ti_ser01 from index
         if  ti_ser01-sernr = ti_equi-sernr
              and ti_ser01-matnr = ti_equi-matnr.
            move-corresponding ti_ser01 to ti_ser011.
            append ti_ser011.
            index = sy-tabix.
            exit.  
         endif.
        endloop.
    endloop.
    here i have used one more internal table ti_ser011.
    you can delete specific record from ti_ser01 internal table on condition. at that time u don't need to create any other internal table like ti-ser011.
    in place of loop select statement---endloop.
    you can use this code. I think it will help you.
    please find if it is udeful.

  • How ro make an Code Bar in Smartforms

    Hello:
    I would like to make one question, i have been trying to make an code Bar into Smartforms, so the question is.
    is it possible make that into smartforms?
    thanks a lot i will really appreciate if somebody know how to do that

    Hi,
    Check these links,
    http://www.zebra.com/id/zebra/na/en/documentlibrary/misc/sap_smart_forms_faqs.File.tmp/SAP_SmartFormsFAQ.pdf&dvar1=null&dvar2=null&dvar3=null
    http://www.servopack.de/Files/HB/ZPLcommands.pdf.
    http://help.sap.com/saphelp_nw04/helpdata/en/d9/4a94c851ea11d189570000e829fbbd/content.htm
    http://www.sap-img.com/abap/questions-about-bar-code-printing-in-sap.htm
    Regards,
    Azaz Ali.

  • How to make material code field mandatory in VA01

    Dear all,
    I want to make material code field mandatory while creating sales order (VA01). As of now even if I dont enter material code , and just enter customer code and P.O. number ,  I am able to save my sales order.
    I tried to do it with incompletion log , but could not succeed.
    SHD0 could be an option, is there any simpler way out ?
    Please suggest.
    Regards,

    Hi,
    You have 2 options.
    1 - Incompletion Log
    If you add Material filed to your incompletion log, then when you try to save the sales order it'll give the "Save / Edit" pop up message. But then by pressing Save button you can save the sales order.
    If you want to avoid that pop up; do this. (To avoid user saving Incomplete sales orders)
    Go to VOV8 Tx.
    Go in to your sales document type
    Under "Transaction flow" section mark the "IIncompletion messages" tick box
    Then try with a new sales order without a material number
    If won't give that pop up message any more where as it'll always go in to the incompletion log. So you can't save it without maintaining the material.
    That's a alternative way of doing.
    2- SHD0.
    Best regards,
    Anupa

Maybe you are looking for