Want to save time while doing inserts or updates using JDBC

I want to save time while doing inserts/updates in a database in my Java app. using JDBC. My app. has to do a lot of inserts and that takes up a lot of time.
I can do some buffering and then do bulk/batch inserts if that will help. any pointers on whether this will be useful and how to go about it?
Is there any other way I can save time and thereby improve performance?
I am using Oracle 8 with Oracle thin driver.
Thanks

I tried using the PreparedStatement.addBatch() and PreparedStatement.executeBatch() in a test program.
The error is SQLException - "Unsupported feature" which I get at the addBatch method call. I am using oracle thin driver sdk 8.1.6 for jdk 1.2.x
What is wrong here?
Thanks

Similar Messages

  • Error while doing multiple object updation from EP ! object lock error

    HI all,
    I am doing multiple  object updation using a standard RFC(BAPI_PROJECT_MAINTAIN). The RFC i am calling from Enterprise portal. I am sending data to RFC one by one. But the error i am getting is object is locked by user so data can't be save.
    Though i am using Lock and unlock method before and after calling RFC the project lock error comes up.
    What might be the reason
    regards
    sandeep

    Hi Sandeep,
    Is the RFC you use for locking in the same model as the bapi BAPI_PROJECT_MAINTAIN? If it is not then you are using two connections for communication with the sap R/3 backend.
    You can do 2 things.
    1. You could add the RFCs for locking in the same model as the BAPI_PROJECT_MAINTAIN
    2. Instead of adding the RFCs in one model synchronize the connections the models use as follows:
    IWDDynamicRFCModel model1 = (IWDDynamicRFCModel) WDModelFactory.getModelInstance(Model1.class);
    IWDDynamicRFCModel model2 = (IWDDynamicRFCModel) WDModelFactory.getModelInstance(Model2.class);
    model1.setConnectionProvider(model2);
    You can do this in the wdDoInit. This will make sure both models use the same connection but closing a connection will close both at the same time.
    The same problem applies to commit/rollback functionality.
    Regards,
    Jeschael

  • Getting Do you want to save changes while pressing F11

    Hello,
    I created one Custom Form by using template.fmb. In that 2 database blocks and 2 control blocks. In database blocks also couple of items are non database items. When ever I open the form from Oracle Applications and pressing F11 with out doing any changes then it is prompting for Do you want to save changes? If i am pressing Yes then (in my form i am using sequence). that one is generating and saving. After saving it is going into enter query mode.
    Can you please help me out how to avoid this message and why this message is coming.
    Regards,
    Akash Vandan

    You are getting this problem because you are probably modifying one of the fields in PRE or WHEN-NEW triggers. Just check if you have assigned any value to the fields using. you can search for colon (:).
    Just delete that part of code and your form will work fine.
    Regards,
    Ashish Kanak

  • Error - '.' expected - while database insert thru JSP & javabeans & JDBC

    I get the following error when i try to compile the below mentioned code in JDEVELOPER 10.1.2
    Error : '.' expected
    ===================
    have error in my code. I am trying to do a simple database insert program using javabeans and jsp. I get a value to be inserted in database through the jsp page in a text box and would like to be inserted into database using beans The connection to database and mysql query are in java file.
    Here is the code.
    <%@page contentType="text/html"%>
    <%@page pageEncoding="UTF-8"%>
    <%@ page language="Java" import="java.sql.*" %>
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
    <%@ taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql" %>
    <html>
    <head>
    </head>
    <body>
    <form name="form1" action="beancode" method="POST">
    Emp ID: <input type="text" name ="emplid"> <br><br><br>
    <input type = "submit" value="Submit">
    <jsp:useBean id="sampl" class="beancode" scope="page">
    <jsp:setProperty name="sampl" property="*"/>
    </jsp:useBean>
    </form>
    </body>
    </html>
    I know i might have made a mistake here in using the bean. Here is the java code which does the insert part.
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.PreparedStatement;
    import java.sql.ResultSet;
    * @author Trainees
    public class beancode
    private String employid;
    private Connection con = null;
    private ResultSet rs = null;
    private PreparedStatement st = null;
    /** Creates a new instance of beancode */
    public beancode()
    try
              Class.forName("org.gjt.mm.mysql.Driver");
              Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/sample?user=user&password=password");
    catch(Exception e)
              System.out.println(e.getMessage());
    public void setemployid(String empid)
              employid = empid;
         public String getemployid()
              return (employid);
    public void insert()
    try
    String s1="insert into samp values('"+employid+"')";
    st = con.prepareStatement(s1);
    st.executeUpdate();
    st.clearParameters();
    st.close();
    catch(Exception m)
    }

    It's pretty hard to spot any errors the way it's currently formatted. But, you're trying to call the beancode when submitting your form, but the beancode isn't a servlet. Try to find a working example, run it, and then change it to implement your requirements.
    The following example shows you have to use the jstl sql tags: http://www.oracle.com/technology/sample_code/tech/java/codesnippet/jsps/jstlsql.html. If you want to do an insert when a user submits a form, you need 2 pages. The first will contain your form, the second will insert the record.
    (once you've got that running, look for some examples using an mvc framework, and how to use bind variables with jdbc)

  • I want to write condition while creating table/maintaining table using SM30

    Hello all,
    I am creating table Z_CUST with only 2 fields Client, Customer number using SE11 transcation then maintain using SM30 transcation.
    User should only be allowed to enter customer number that is in account group(KNA1-KTOKD) ‘Z011’. This  validation should be performed during data entry.

    Hi,
    Crete the table maintenance generator for your Ztable.
    below is the brief procedure to create table maintenance.
    Table maintenance generator is basically used to do table operations like (insert, delete, modify...).
    if you create table maintenance for your table it will build a module pool program, by using you do the above operations.
    below is the procedure to create table maintenance generator.
    1) Create one function group.
    2) after activating your Ztable, choose 'Utilities'----> 'Table maintenance genrator'.
    3) then give the authorization group and function group created abobe in the next screen.
    4) Then choose the "create" button in your application tool bar, which will creates the module pool program.
    5) then create one Tcode by chosing "Transaction with parameters( parameter transaction)".
    6) in transaction field give "SM30", select the check box "Skip initial screen".
    7) in the below of that screen you can find the "Default values" frame.
    8) there under the "name of screen field" select the "View name' and 'update".
    9) in value column against to "view name" give you table name, and against to "Update" put 'X' in capital letters.
    save it then you can straight away use this newly created Tcode to maintain your table.
    Note:- 1) make the modification while saving the data into your table using this newly generated program to carry out your validation (even though it looks like standard program; no need to enter the access key).
    2) if you do any changes to your table and press the activate button automatically the table maintenace generator will be goes off, you need to create this again.
    Reward if useful.
    Thanks,
    Sreeram.

  • While doing GR/IR Maintainance using MR11

    Hai Friends,
    While doing the GR/Ir mainataince account using the T-code MR11 'Am getting the Error The Object Re_BLEG does not exist for the interval 04'
    For this i  maintain the number  using T-code FBN!, even though its showing the same Message
    please Help Me

    FBN1 is number range for accounting document
    but the message complains about RE_BELEG which is invoice document
    check with transaction SNUM the number range for RE_BELEG

  • I want to save my entire movie library should i use an external drive?

    I have over 700 movies that i want to save on a drive, should I use an external drive to use with my macbook pro?

    Pretty much any external HDD would work. LaCie and WD are good manufacturers, though my Hitachi 1TB SimpleDrive has also been a good drive.

  • Error while connecting to Oracle db using jdbc

    When I try to execute a java class which has to access data in
    the Oracle db using Jdbc connection, get an error --
    Appln- pathname/filename is attempting to call the OCI function
    (opinit) this function does not exist in ORA72.DLL.
    Exit this appln ? Yes or No
    Both oracle db & java are on the same PC.Would like to know what
    can be done to rectify this.
    Thanks.
    null

    The OCI driver 7.3 requires the 7.3 OCI to be installed (this is
    part of the client required support files or RSF). The particular
    call in question wasn't added to the OCI untill 7.3 so it
    wouldn't exist in the 7.2 OCI library.
    null

  • ORA-01422 Error While Doing Insert

    Hello,
    I am trying to do a insert using the following code
    declare
    i number;
    ret varchar2(1000);
    ret2 varchar2(1000);
    ret3 varchar2(1000);
    begin
    FOR I IN 1..20 LOOP
    select sl_no ,ename,addr into ret,ret2,ret3
    from
    (select u.sl_no as sl_no,
    (select ename from table where sl=1  and des  = 1 ) as ename ,
    T.addr as addr  from
    tab1 t,tab2  u
    where
    U.cd = T.cd
    and U.code = T.code and U.sl=0+i
    union all
    select u.sl_no as sl_no,
    (select ename from table where sl=1  and des  = 1 ) as ename ,
    T.addr as addr  from
    tab1 t,tab2  u
    where
    U.cd = T.cd
    and U.code = T.code and U.sl=0+i);However I am getting error
    ORA-01422: exact fetch returns more than requested number of rowsHow could I resolve this problem
    Thanks

    @OP,
    Some of the points in your "FULL CODE".
    1.You are selecting in a FOR I 1..20 LOOP... The SELECT statement has INTO clause. With UNION (ALL) may be you are expecting (and getting) more than one row in which case you need to define cursor and fetch from the cursor .
    2. You have a COMMIT within the loop, it may be ok if you want to commit 20 times! In general, Please commit when the logical unit of work (LUW) is completed. In my experience LUW is normally not completed within a loop.
    3. Why even have a LOOP and PL/SQL procedural code?
    Why not do the following...
    insert into my_table(sl_no,ename,addr)
    select sl_no ,ename,addr into ret,ret2,ret3
         from
         (select u.sl_no as sl_no,
         (select ename from table where sl=1  and des  = 1 ) as ename ,
         T.addr as addr  from
         tab1 t,tab2  u
         where
         U.cd = T.cd
         and U.code = T.code and U.sl=0+i
         union all
         select u.sl_no as sl_no,
         (select ename from table where sl=1  and des  = 1 ) as ename ,
         T.addr as addr  from
         tab1 t,tab2  u
         where
         U.cd = T.cd
         and U.code = T.code and U.sl=0+i);4. If you absolutely have to have PL/SQL code try something like folloing...
    declare
    i number;
    ret varchar2(1000);
    ret2 varchar2(1000);
    ret3 varchar2(1000);
    begin
    FOR I IN 1..20 LOOP
      FOR x in (              -- "Added"
         select sl_no ,ename,addr into ret,ret2,ret3
         from
         (select u.sl_no as sl_no,
         (select ename from table where sl=1  and des  = 1 ) as ename ,
         T.addr as addr  from
         tab1 t,tab2  u
         where
         U.cd = T.cd
         and U.code = T.code and U.sl=0+i
         union all
         select u.sl_no as sl_no,
         (select ename from table where sl=1  and des  = 1 ) as ename ,
         T.addr as addr  from
         tab1 t,tab2  u
         where
         U.cd = T.cd
         and U.code = T.code and U.sl=0+i)
       LOOP ;                -- "Added"
       insert into my_table(sl_no,ename,addr)
       values (ret,ret2,ret3);
    end loop;               -- "Added"
    commit;
    end loop;
    end;vr,
    Sudhakar B.

  • Problem while doing insert

    Hello.
    I'm trying to write the following String containing an XML document, in a MySql database:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE ReporteHoras SYSTEM "ReporteHoras.dtd">
    <ReporteHoras>
    <Persona nombre="Daniel">
    <Fecha dia="1/11/2004" horas_teoricas="8">
    <Proyecto cod="001">
    <Tarea nombre="x">
    <Horas>8</Horas>
    </Tarea>
    <Tarea nombre="y">
    <Horas>5</Horas>
    </Tarea>
    </Proyecto>
    </Fecha>
    <Fecha dia="2/11/2004" horas_teoricas="7">
    <Proyecto cod="010">
    <Tarea nombre="z">
    <Horas>8</Horas>
    </Tarea>
    </Proyecto>
    </Fecha>
    </Persona>
    </ReporteHoras>
    And I get the following exception:
    (ReportesReceiver.HorasGMSReceiver 219 ) error al ejecutar tareas SQL: java.sql.SQLException: Syntax error or access violation, message from server: "You have an error in your SQL syntax near 'VALUES ('91750418', 'horasgms', '<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!D' at line 1"
    4729468 [imqConsumerReader-0-8919380558701437696-0] ERROR starting.src.java.ReportesReceiver.HorasGMSReceiver - error al ejecutar tareas SQL: java.sql.SQLException: Syntax error or access violation, message from server: "You have an error in your SQL syntax near 'VALUES ('91750418', 'horasgms', '<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!D' at line 1"
    java.sql.SQLException: Syntax error or access violation, message from server: "You have an error in your SQL syntax near 'VALUES ('91750418', 'horasgms', '<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!D' at line 1"
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:1697)
    at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1083)
    at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1142)
    at com.mysql.jdbc.Connection.execSQL(Connection.java:1876)
    at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1590)
    at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1653)
    at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1492)
    at starting.src.java.ReportesReceiver.HorasGMSReceiver$GMSListener.onMessage(HorasGMSReceiver.java:210)
    at com.sun.messaging.jmq.jmsclient.MessageConsumerImpl.deliverAndAcknowledge(MessageConsumerImpl.java:247)
    at com.sun.messaging.jmq.jmsclient.MessageConsumerImpl.onMessage(MessageConsumerImpl.java:210)
    at com.sun.messaging.jmq.jmsclient.SessionReader.deliver(SessionReader.java:76)
    at com.sun.messaging.jmq.jmsclient.ConsumerReader.run(ConsumerReader.java:153)
    at java.lang.Thread.run(Thread.java:534)
    It seems that the string contains some illegal characters, but I don't know where they are.
    I do the following to insert the data:
    java.sql.Connection conn = conexion.getDbConn();
    PreparedStatement pstmt = conn.prepareStatement(insertSQLString);
    pstmt.setString(1, processId.toString());
    pstmt.setString(2, "horasgms");
    pstmt.setString(3, contenido);
    pstmt.executeUpdate();
    Can anyone tell me what am I doing wrong?
    Thank you in advance.
    Regards.
    Dani.

    > > <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE ReporteHoras SYSTEM
    "ReporteHoras.dtd">This is where the illegal character comes ... I think
    it has a problem with "!"
    ***Annie***Caller = aashu Site = unknown Caller Info. = singh Kind = level1 state = OPEN Errorjava.sql.SQLException: Syntax error or access violation, message from server: "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' Project_Name, Client_Location, Client_Country, Client_Contract_HW INTO client_i' at line 1"
    codes as following:-
    <%@ page import="java.util.*,java.text.DateFormat, java.io.*,java.net.*,java.sql.*,java.sql.Connection,java.sql.DriverManager,java.sql.Statement"%>
    Caller = <%=request.getParameter("caller")%>
         <% String s = request.getParameter("caller");%>
         Site = <%=request.getParameter("site")%>
         <% String s2 = request.getParameter("site");%>
    Caller Info. = <%=request.getParameter("callerinfo")%>
         <% String s3 = request.getParameter("callerinfo");%>
         Kind = <%=request.getParameter("kind")%>
         <% String s4 = request.getParameter("kind");%>
    state     = <%=request.getParameter("state")%>
         <% String s5 = request.getParameter("state");%>
    <%
    try     
    { Class.forName("com.mysql.jdbc.Driver").newInstance();
                        // String connectionURL ="jdbc:mysql://localhost:3306/client_db1?user=;password=";
                   //Connection con = DriverManager.getConnection(connectionURL,"","");
         Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/client_db1?user=;password=","","");
         Statement st = con.createStatement();
    st.executeUpdate("INSERT Client_Name, Project_Name, Client_Location, Client_Country, Client_Contract_HW INTO client_info values('"+s+"', '"+s2+"', '"+s3+"', '"+s4+"', '"+s5+"')"); %>
    <%}
    catch(Exception e)
    { out.println("Error"+e);
    %>[b]

  • IPhone crashes every time while doing his backup, can´t sync regulary

    Every time I try to sync my iPhone with iTunes, the iPhone crashes 1 minute after putting the iPhone into the dock and started the sync process. After the crash, the iPhone icon disappears in the device list and appears again after a few seconds. Then I have to unlock the iPhone again.
    The only way to get content on the phone is to delete everything off the phone (unmark addressbook, calender, bookmarks, all music, all podcasts, all videos), do a sync to delete the whole content, then do a second sync, this time with the marked lists. So it´s not a sync, it´s only a one way data transfer to the iPhone.
    It´s horrible because it takes a long time to get all movies on the phone every time from the very beginning and it´s not the way I would like to use the phone.
    I did complete new installation with resetting the iPhone and a complete fresh installation of OS 1.1.2, nothing has changed.
    What can I do?
    best regards

    It sounds like you might have tried this already, but I'd first turn off automatic syncing with your phone and then just try syncing video. And then try syncing calendar. And then try music, etc.
    Some folks have reported issues with their mail sync and in this particular case I'd suspect that as a culprit, so I'd leave that sync off until the very end. If it turns out to be the case then you just need to reconfigure your mail properly. But first you need to determine exactly what is happening and only by syncing one category at a time can you figure out where the problem is lurking.

  • I am upgrading to win7 custom instal and want to save my bookmark in a file to use in a new ff instal

    doing a custom instal upgrade to win7 and i want to know how to save my bookmarks on a flash drive to reaply to the new firefox browser when i am done

    See http://kb.mozillazine.org/Backing_up_and_restoring_bookmarks_-_Firefox

  • Save data while closing Flex mobile application using HTTPService

    On close of the Flex mobile application I need to save some information to the back-end by using HTTPService.
    On creationComplete() of the application I am adding :
    NativeApplication.nativeApplication.addEventListener(Event.EXITING, onExit);
    On close of the mob application, the following method will get call.
    private function onExit(e:Event):void
        httpServiceCall("log event data");
    The request itself is not reaching backend. I have tested this by installing Wireshark, there is no entry if I close the application in wireshark(wireshark will just catch any kind of requests from frontend to backend).
    I am introducing delay to achieve this :
    public var closeTimer:Timer;
                private function onExit(e:Event):void
                    e.stopImmediatePropagation();
                   httpServiceCall("log event data");
                    closeTimer = new Timer(3000,1);
                    closeTimer.addEventListener(TimerEvent.TIMER_COMPLETE, closeApp);
                    closeTimer.start();
                protected function closeApp(event:Event):void{
                    NativeApplication.nativeApplication.exit();
    The above code is not working. As soon as control comes to onExit() method, application is closing.
    According to my understanding, I have to introducesome delay before closing the application to achieve this requirement. How can I introduce delay in this case?

    Try opening Task Monitor and killing any existing "adl" process before launching.
    Does this help ?

  • Doubts while doing  example on WDJ-Using Web Dynpro Component Interface

    Hi
    I am doing the example mentioned in the PDF file WDJ - Using Web Dynpro Component Interface Definition.
    In the PDF file its mentioned the following code inside onActionCreateDC1:
    g_Usage.createComponent("com.sap.wd.childdc1comp.ChldDC1Comp");
    wdThis.wdGetWDCompInterfInstInterface().passInfo(
    "Created Child DC 1");
    I have one query that what is com.sap.wd.childdc1comp.ChldDC1Comp?Is it the component name of DC or the package name of DC?
    I have deployed the application.When i click on button Create Child DC1 i am getting follwing exception:
    com.sap.tc.webdynpro.services.sal.deployment.api.WDDeploymentException: Failed to load deployable object part 'com.wartsila.test.ChileDC1Comp', type 'Component' of deployable object 'wartsila.com/DP_TutWDInterfaces'.
    When i click on Create Child DC2 i am getting follwing exception:
    com.sap.tc.webdynpro.services.exceptions.WDRuntimeException:Failed to create delegate for custom controller com.wartsila.test1.ChildDC2CompInterfaceCfg. (Hint: Is the corresponding DC deployed correctly? Does the DC contain the component?)
    Can anybody tell how can i solve it?
    Is it required to deploy the two child component also that is ChildDC1Comp and ChildDC2Comp?If yes then how to deploy these two child DC as when i am tryng to create application for these two component then default plug is showing blank thats why i am unable to deploy these child Dcs.
    Thanks
    Susmita

    Hi Susmita,
                      Is it required to deploy the two child component also that is ChildDC1Comp and ChildDC2Comp?
    Yes , u have to deploy both the components.
    when i am tryng to create application for these two component then default plug is showing blank thats why i am unable to deploy these child Dcs.
    U need not create an Application for deploying the component .Right Click on ur project --> Deploy.
    The problem is with ur Component, while creating a Component u should have created a Interface view and default StartUp plug.
    Just check whether u have Created the startup plug for ur interface view.
    Open the controller editor of ur interface view --> Select Plugs Tab .
    and in the plug tab , check whether u have Default Start plug (in Inbound Plugs Table).
    if there is no Default Start Plug , then click the Button New to create a Default Plug .
    in the pop up window -- select Stsrt Up and Give the name of the plug as "Default".
    After doing this , select the default plug and Right click on the plug -->copy  and Open the window Controller editor -- > select Plugs Tab --> check whether u have default plug (in Inbound plugs) in the Window controller .
    if the plug is not there , then paste the plug in the Window's Inbound Plug Table .
    Hope it helps
    Thanks and Regards

  • Getting Error while doing month end provisions using FS00

    Hi Guru,
    please suggest.
    while making month end provisions for salraies by using t code FS00 geeting error that Account XXXXX does not exist in company code level
    please help me on reslove this.
    Rgds..Suresh

    Hello Suresh,
    The GL Account does not exist for that Company code. Hence extend the GL Account to the Company Code by using Copy with template in FS00.
    Regards
    Kalpana

Maybe you are looking for

  • Iv just installed cs6 and it will not open raw files from canon 5d111?

    iv just installed cs6 it will not open cr2 files from my canon 5d111 ?

  • Error Installing Yosemite

    The download is complete but it keeps giving me an error of "This disk has S.M.A.R.T. errors.  This disk has a hardware problem that can't be repaired.  Back up as much of the data as possible and replace the disk." I need to know what this means an

  • How to run a script after resume from disk in pm-utils

    When I use pm-hibernate, I have a few scripts that I would like to run upon de-thawing. At the moment, all I want to do is module-related: I want to remove the pcskpr mod (which I have blacklisted in my rc.conf MODULES array, but HAL loads it upon th

  • ORA-03113 when trying to connect to database

    RDBMS Version:: 9.2.0.6 Operating System and Version:: Win2003 Small Business Server Error Number (if applicable):: ORA-03113 Server Net Version:: 9.2.0.6 Client Operating System and Version:: Solaris10 Client Net Version:: 2.1.3 ORA-03113 when tryin

  • Windows 7 not registering IPv4 address in DNS

    We have been testing Windows 7 and noticed that the Windows 7 systems are not registering the IPv4 information in the DNS though IPv6 information is registered in the DNS.  These test systems are in-place-upgrades from Windows Vista to Windows 7. The