Same preparedstatement object for different queries.. ?

Actually I m getting same preparedstatement object for many queries in a for loop..In this scenario its not working properly..Suppose like dis..
connection con.setAutoCommit(false);
PreparedStatement prepStmt = con.prepareStatement(
"UPDATE DEPT SET MGRNO=? WHERE DEPTNO=?");
prepStmt.setString(1,mgrnum1);
prepStmt.setString(2,deptnum1);
prepStmt.addBatch();
PreparedStatement prepStmt = con.prepareStatement(
"UPDATE EMP SET EMPNO=? WHERE DEPTNO=?");
prepStmt.setString(1,empno1);
prepStmt.setString(2,deptnum2);
prepStmt.addBatch();
Whether we can take same preparedstatement object for different query..??Its not giving any error but its not updating all the records but only the last one...
Any solution..

kriti123 wrote:
Actually I m getting same preparedstatement object for many queries in a for loop..In this scenario its not working properly..Suppose like dis..
Ignore all of the above.
You are using a batch.
There is a specific idiom for that. You create the statement once and then keep calling the appropriate methods on it to load and then execute the batch, and check errors.
When done you close it. If you need commit you are going to need to deal in blocks.
If you have a large volume of data then database import tools are very likely to be substantially faster.

Similar Messages

  • Can I use same result set for two queries?

    Hi,
    Can I use the same result set for two queries?
    For example:
    ResultSet rs = null;
    rs = ps.executeQuery(query1);
    while (rs.next()) {
    rs = ps.executeQuery(query2);
    while (rs.next()) {
    Is it OK to use? or Is there any preformance issues?
    Appreciate your help.
    Thanks in advance.
    Prasad Vagolu

    Sure. You have a variable of ResultSet type. First you create a ResultSet and assign it to that variable. Then later you create another ResultSet and assign it to that same variable. Assigning an object reference to a variable takes essentially no time, and at any rate it isn't any faster to assign it to a different variable. Also, no matter whether you use one variable or two, you are still creating two ResultSets.
    However, you really should be closing your ResultSets after you finish using them. That's nothing to do with the assigning-to-a-variable question.

  • Can i use the same email address for different users?

    we are a small department with one email address, can i use the same email address for different users?

    No. Each user needs to have his unique ID.
    Mylenium

  • Is it possible to have same file size for different dpi?

    I changed one.TIFF file (300dpi, 1024X1332)  to .jpg files of four different dpi. But when I checked the four result jpg files, I found out that they are all in same file size and quality.( I also have checked the property of the files in the Windows.)
    I think more DPI means more data and more file size. Am I wrong?
    I use Photoshop CS 5.1(64bit, WINDOWS) - which is part of my Adobe Master Collection CS5.5.
    TIFF(300dpi, 1024X1332) ->
    1. JPG(72dpi, 1024X1332) : 306KB
    2. JPG(108dpi, 1024X1332) : 306KB
    3. JPG(144dpi, 1024X1332) : 306KB
    4. JPG(600dpi, 1024X1332) : 306KB
    I tested a few times more with different files. and same result comes out.(same file size for different dpi)
    Thanks in advance.

    Yes absolutely. Great observation.  PPI does not control the number of pixels, just how big they are.
    Now, if you change the PPI in the Image Size dialog with Resample checked.. then, that is a different story. In that case you will be changing the pixel dimension of an image (i.e.,changing the total number of pixels making up the image) while keeping its print size.
    In your test files, you will notice all the print sizes are different, because all you were telling Photoshop to do was change the size of the pixels (if or when the image is ever printed), which is really just a bit of metadata of the file.

  • Can we use same number range for different  fields

    can we use same number range for different  fields. how can we see the number range defined for a particular field

    Hai,
    Yes you can have same number range for different fields  by using the same domain to the data elements that are user to your two fields.
    To see the range:
    Go to SE11,Type table Name open it-->double click on the DataElement adjasent to the field name ,You will get Domian ,Double click on Domain You will get Domain.There See Value range option .Value range cam also be defined by Value Table which will also at the Doamin level.
    <b>Reward points if it helps you.</b>
    Regds,
    Rama.Pammi

  • Authorisations in BW for different Queries and one InfoObject

    Hi,
    we have a problem regarding Authorisations in BW.
    Some of our users have different rights on different queries e.g. for the Info-Object 0PLANT. For the query ABC he should see data to more plants than for the query XYZ.
    Our idea was to build an Authorisation-Object containing 0PLANT, TCTQUERY, TCTIFAREA and TCT ICUBE and to set the authorization for 0PLANT regarding the detailled name of the query (TCTQUERY). But this doesn't work because when starting the query SAP doesn't check the name of the Query. And so the user can always see the sum of plants set in both authorisations.
    Maybe someone of you has useful hints.

    Hi Andreas,
    In your case you need to use hierarchical authorizaton object to provide data restriction on the queries. Thus everyone can have the same query and they view what ever they are supposed to. Please find the how to document called: "How To…Work With Hierarchy Authorizations" You will find detalied information and businees scenario about the topic. Please let me know if I can assist you further
    Regards

  • Need Different Selection screen for different Queries in a Workbook

    Hi,
    I have created a workbook with Multiple tabs in BI 7.0.  Each Tab has different Queries and each query has different Selection screens (Variable Selections).
    When i open the workbook and refresh it, the selection screen is appearing only for one query.  All the queries are refreshed by this single selection screen, though each query has different Variable selections.  What i need is a seperate selection screen i.e seperate Variable selection appearing for each queries, when i refresh each one of them.
    Is it possible to do this?  If anybody has tried this, help me in solving this issue.  Thanks for ur time.
    Regards,
    Murali

    Murali,
    If you un-check the 'Display Duplicate Variables Only Once' this WILL solve your problem.
    When you Refresh, you should be presented with a single variable selection dialog box, but it should contain an area for each Query (DataProvider) that is embedded in the Workbook.
    This is the case if the queries are all on the same tab, or on different tabs.
    However, if you have multiple tabs each with a query on it, each query must have it's own DataProvider. If all queries are based on the same DataProvider, it will not work as the Workbook only 'sees' one Query for which it needs variable input.
    If you REALLY want multiple variable selection dialog boxes, then maybe the best way to do this is to have the queries in separate Workbooks.
    If you don't want the User to have to open 5 queries manually, you could use a Macro in each Workbook that runs on opening, to open the next Workbook in the sequence.
    I hope this makes sense!
    Regards
    Steve

  • Instead of creating new resource, recon is updating the same resource object for a user

    Hi,
    I created a DB target recon in OIM 11g. I ran recon and it created resource object. Resource is visible in Accounts tab.Now, I added one more entry with different description in DB. I ran the recon again. This time, instead of creating new resource object, recon linked it the same user with same resource object.
    My requirement is to create as many resource object as there are entries in DB table. The recon should not link all DB entries with same resource object in IDM. For every entry in DB, recon should create that many resource objects in accounts tab of user.
    Please let me know how to achieve the same.
    Regards,
    Kalpana.

    Hint is : Verify Reconciliation Key field mapping in Process definition
    Thanks,
    Pallavi

  • Scaling front panel objects for different screen sizes

    Hi,
    Can anybody help me of designing Vi for different screen sizes. I have designed a VI for a monitor of small size and lower resolution but when I open the same Vi on a different monitor,objects are not aligned properly. The properties which I have changed are
    Window appearence->Default
    Window Size -> Panel size 0,0   & Tick marked options of Maintain propotions for different monitors and scale all objects 
    Window Run Time position-> Maximum
    Regards
    Imran
    Solved!
    Go to Solution.

    Imran,
    I can't solve your problem entirely.  However when I have to write a program that will be deployed on a variety of monitor sizes, I tend to set the size of the Front Panel to suit the smallest monitor, and then remove the ability of the user to resize it.
    Also, set it to run in the centred position.
    See attachments.
    Many Thanks,
    Dan
    Dan
    CLD
    Attachments:
    Customize Window Appearance.JPG ‏44 KB
    VI Properties.JPG ‏29 KB

  • Different execution plan for same query but for different condition value

    Hi All,
    I'm facing a strange situation where same query for different condition not working.
    1--
    Select  top 10 * from revenuefact(nolock) 
    where feecode ='OW4'
    2--
    Select  top 10 * from revenuefact(nolock)
    where feecode ='BTE'
    1st query is returning result easily but 2nd query is taking too long. Column
    feecode has already Non-clustered index and Clustered index is also available for another col RevenueSID.
    I was surprised when checked the query execution plan for both the above queries  which is quite different (as per attached below). Can anyone suggest me the reason behind it.
    And solution for the same. One more thing that data for feecode BTE is inserting through different source instead of others feecode and table contains more than 300 million rows.

    When I speak with people inside Microsoft who work with the optimizer, the refuse to accept the work "bug" when a query produces the correct result, but with a suboptimal plan. They prefer to use the word "limitation".
    The limitation here is that when the optimizer compares two plans, it only looks at the estimated cost. As far as I know, it does not perform any analysis from the perspective "what if the statistics are wrong"? They do provide the hint OPTIMIZE
    FOR UNKNOWN, but that does not work then there is a constant as in this case.
    The optimizer will surely distinguish between TOP 10 and TOP 10000000. With the latter, you have all reason to expect a Clustered Index Scan no matter which value you search for - unless you pick a value for which the histogram indicates that there are no
    rows.
    Interesting enough, I was able to reproduce the situation in my Northgale database, which is an inflated version of Northwind, and where statistics should be accurate.
    SELECT TOP 10 * FROM Orders WHERE EmployeeID = 8
    results in a CI scan, and so does also EmployeeID = 7, and even 5. There are only 2292 rows out of a total of 344305 rows. If I try EmployeeID 808 for which there are 1797, the optimizer goes for the index seek.
    Erland Sommarskog, SQL Server MVP, [email protected]

  • Message-Mapping: Use same RFC lookup for different target fields

    Hello,
    I need to apply an RFC Lookup which delivers a boolean flag back (true or false). This RFC lookup should be used for different target fields.
    Is there a way to execute the RFC lookup just once and then store the result in an internediate variable that I can use for all futher checks for different target fields?
    If this is not possible and I have to apply the RFC lookup for all necessary target fields is it then executed for each target field ? This is exactly what I want to avoid in order not to slow down performance.
    The input parameter (=source field value) would be the same.
    Thank you for your advice!

    Exactly.
    Here is a UDF example I have that you could adapt to your needs.
    Set
    public String setCounter(String a,String b,Container container){
    /* Store values in global datacontainer
    a: mapping value and return valueparameter
    b: name for stored value parameter
    GlobalContainer myGlobalContainer;
    myGlobalContainer = container.getGlobalContainer();
    myGlobalContainer.setParameter(b.toUpperCase(), a);
    return a;
    Get
    public String getCounter(String a,Container container){
       //write your code here
    GlobalContainer gc = container.getGlobalContainer();
    if (gc.getParameter(a) != null) {
      return String.valueOf(gc.getParameter(a));
    } else {
    return "1";

  • The same output message for different partner roles

    Hi All,
    Is it possible to create automaticaly in PO the same output message type ( for example - 'mail') for different partner roles( for example - 'VN' and 'OA') ?
    If it's possible,then how?
    Thanks.
    Liza

    Hi,
    Thank you ,but I have a next problem:
    When I  tried in transaction mn05 to add second record for the same output type for other  partner roles.
    I got error message "The condition record entered already exists".
    Regards,
    L.

  • Issues of using same enhancement set for different components

    Hi experts,
    I have an issue when using the same enhancement set(ZCRM_EHSET) for two different components IUICMD & IUICMRD. Component IUICMRD has two views IUICMRD/MainVS & IUICMRD/MeterReading and these views have been copied to Component IUICMD.
    Now, i am getting the following error, when i try to access AccountSearch view of component IUICMD
    Context initialization failed in view IUICMRD/MeterReading of UI Component IUICMD
    An exception has occurredException Class CX_SY_MOVE_CAST_ERROR - Source type \CLASS=CL_IUICMD_BSPWDCOMPONENT_IMPL is not compatible, for the purposes of assignment, with target type \CLASS=CL_IUICMRD_BSPWDCOMPONENT_IMPL
    Method: CL_IUICMRD_METERREADING_IMPL=>DO_INIT_CONTEXT
    Source Text Row: 10
    Let me know how i can solve this. Is there any precautions that i should have taken before using the same enhancement view for two different components.
    Thanks in advance.......................
    Regards,
    Prabahar

    Hi Bharathy,
    Thank you for the reply which helped me to come close to the solution.
    I hope you reply will solve the second part of my question where i get MOVE_CAST_ERROR.
    My first Question is still unanswered and i request you to provide solution if you have any. I worked on CRM 4.0 and CRM 2007 is new to me.
    My first question is below.
    I have two components IUICMD & IUICMRD. I have enhanced 4 views in the first component IUICMD using enhancement set ZCRM_ENHSET. There is no problem with that. But when i try to use the same enhancement set ZCRM_ENHSET for enhancing the second component IUICMRD, it's enhanceable in enhancement set.  But 2 views IUICRMD/Meterreading & IUICMRD/MainVS is also copied to first component and available as enhanceable views in First component.
    Is it the std behaviour that views from one component is copied to other when you try to use the same enhancement set? Kindly let me know if you faced similar situation.
    Best regards,
    Prabahar

  • Same batch number for different order materials

    Hi, pls advise can we assign same batch no's for different production order finished products?

    Yadav,
    Yes, it is possible to assign the same batch number to different production orders in the Order Goods Reciept tab.  If you are not maintaining any batch in this field then you can manually create a batch in MSC1N and use the same when making GR using MB31 or MIGO.
    Regards,
    Prasobh

  • Same error cluster for different instrument drivers?

    Hi All...
    mz question is regarding error cluster wiring for different instrument drivers. As u can see from attached file, i have 3 different devices with drivers. At the beginning i initialize and configure each one by wiring adresses and error clusters individually. After that i want use measruement vi's with an order. That s why I would like to use same error cluster for those 3 different measurment drivers as illustrated in the picture. is it possible?
    second question is that at the beginning in the initializing process, i do not set any order of those 3 devices. VI would try to initialize all of them at the same time which is not possible due to serial GPIB? Do i need to determine any sequences of initializing of devices?
    thanks
    Attachments:
    vi scheme.JPG ‏19 KB

    Your sceme is fine. The error cluster is a generic container to pass any error that can occur from one function to the next. Normally, if a function has it's Error In terminal connected and an error is passed in from a previous function, that function will not do naything except pass the error through so it can be handeled in you code.
    Since your running on serial, just "serialize" your initialization functions using the error cluster to set the order. This way only one will be running at a time. It doesn't matter what order.
    Ed
    Ed Dickens - Certified LabVIEW Architect - DISTek Integration, Inc. - NI Certified Alliance Partner
    Using the Abort button to stop your VI is like using a tree to stop your car. It works, but there may be consequences.

Maybe you are looking for

  • Plant as a condition to determine output messages in PO

    Hi All: I configure condition table  for PO with the fields: Doc Type, Purch Org, Vendor and Plant (all the previous fields at header level except for the plant ) this table is assigned to an access that also contain the condition table: Doc Type, Pu

  • Is Shared Variable Engine with LV8 an OPC server ?

    Hello Is the shared variable engine with LV8 an OPC server ? Does any OPC client can acces to Variable Engine OPC server an read shared variable ? Can I build an installer and deploy my application with Variable Engine OPC server on other PC without

  • "Error on Page" permission denied

    We have several users in our SRM system that encounter an "Error on Page" (permission denied) javascript error when their page is left idle for 5-10 minutes.  This is in spite of the timeout settings being set as follows: SRM Server rdisp/gui_auto_lo

  • No iChat Icons after Time Machine Restore

    I wasn't sure if this should go in the iChat thread... After doing a restore from a Time Machine backup, I seem to no longer get iChat buddy icons. All the buddy icons display the generic AIM yellow guy (save one who is showing the blue globe). The i

  • Error SMARTFORMS081

    Hi; I´m creating an empty Z smartform with just one window with a test text, and when activate the smartform i get the message error that "error generating the form ZTEST(1)", so, it doesn´t generate the function module. Any help. Thanks on advance.