BatchUpdateException Problems

I am trying to play around the batch update method provided in JAVA API 1.3. It works but not without errors. I keep on insert 5 records into my DB2 table by using back the same records. The result is, sometime my code works properly, but sometime it will give me a BatchUpdateException. And I don't know why this could be happened. Attached are the code snippet and also the error log.
Thanks for any advise and reply.
// Code Snippet
if (connection == null) connection = connectDB(); //open connection
if (stmt != null) stmt = null;
sqlQuery = "INSERT INTO FAVOURITE (STAFFID, NAME, ACCTNO) VALUES(?,?,?);
connection.setAutoCommit(false);
stmt = connection.prepareStatement(sqlQuery);
for (int j = 0; j < 5; j++) {
   stmt.setString(1, staffID[j]);
   stmt.setString(2, staffName[j]);
   stmt.setString(3, staffAcct[j]);
   stmt.addBatch();
int [] numUpdates = stmt.executeBatch();
connection.commit();
stmt.clearBatch();
// end code snippet
// Start error log
[11/1/04 22:18:41:086 MYT] 21ab3697 LocalTransact E WLTC0033E: Resource jdbc/dev rolled back in cleanup of unresolved LocalTransactionContainment.
[11/1/04 22:18:41:089 MYT] 21ab3697 LocalTransact E WLTC0032E: One or more resou
rces rolled back. An unresolved LocalTransactionContainment had an unresolved ac
tion of rollback.
[11/1/04 22:18:41:091 MYT] 21ab3697 WebAppTransac E SRVE0183E: LocalTransaction
rolled-back due to setRollbackOnly
[11/1/04 22:18:41:095 MYT] 21ab3697 WebGroup      E SRVE0026E: [Servlet Error]-[
LocalTransaction rolled-back due to setRollbackOnly]: com.ibm.ws.LocalTransactio
n.RolledbackException
        at com.ibm.ws.LocalTransaction.LocalTranCoordImpl.cleanup(LocalTranCoord
Impl.java(Compiled Code))
        at com.ibm.ws.webcontainer.webapp.WebAppTransactionCollaborator.postInvo
ke(WebAppTransactionCollaborator.java(Compiled Code))
        at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAp
pRequestDispatcher.java(Compiled Code))
        at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebApp
RequestDispatcher.java(Compiled Code))
        at com.ibm.ws.webcontainer.servlet.InvokerServlet.service(InvokerServlet
.java:255)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java(Compiled Code
        at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(Stric
tServletInstance.java(Compiled Code))
        at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(Stric
tLifecycleServlet.java(Compiled Code))
        at com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecy
cleServlet.java(Compiled Code))
        at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(Strict
LifecycleServlet.java(Inlined Compiled Code))
        at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstan
ce.java(Compiled Code))
        at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(V
alidServletReferenceState.java(Compiled Code))
        at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(Ser
vletInstanceReference.java(Inlined Compiled Code))
        at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDi
spatch(WebAppRequestDispatcher.java(Compiled Code))
        at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAp
pRequestDispatcher.java(Compiled Code))
        at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebApp
RequestDispatcher.java(Compiled Code))
        at com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.jav
a(Compiled Code))
        at com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebApp
Invoker.java(Compiled Code))
        at com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvoc
ation(CachedInvocation.java(Compiled Code))
        at com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(Ser
vletRequestProcessor.java(Compiled Code))
        at com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSE
Listener.java(Compiled Code))
        at com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnect
ion.java(Compiled Code))
        at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.ja
va(Compiled Code))
        at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:449)
        at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java(Compiled Code))
//end error log

I would suggest that you google using the following string....
"An unresolved LocalTransactionContainment"

Similar Messages

  • BatchUpdateException.getUpdateCounts() problem

    When error ouccurs using statement.addbatch() and statement.executeBatch() in JDBC 2.0, I want to see how many statements are sucessfully excuted and at what point the error ouccured. So I used BatchUpdateException.getUpdateCount(). however, in the int[] returned, all elements contain -3, which is flag for EXECUTION_FAILED. this int[] supposed to have either the affected line number for each statements, or a -2, the SUCESS_NO_INFO for the all suceesed statements, and have -3 for all failed ones.
    please help

    I agree. I am in the same dilemma. I really need to know which one failed in the batch. I think oracle is not in compliance with the JDBC specs.

  • Oracle Batch update problem

    Hi,
    I have a queer problem with batch inserts in oracle, loaded on a sun solaris m/c.
    I'm trying to do a batch insert using the executeBatch() api of java.
    I am able to do batch insertions from my workstation i.e win2k properly . But i'm unable to do so when i run the program on the sun solaris m/c.(The data base is the same)
    Since the JVMs are different i have a feeling it could be the oracle JVM that is giving the problem.
    Please advice me as to how i can overcome this.

    I am having the same problem with a 9i installation on Win2k. My code works fine when run in the Sun JVM on a client. When I try to executeBatch in the Oracle JVM, I get "java.sql.BatchUpdateException: Internal Error: oracle.jdbc.kprb.KprbDBStatement".
    I am using what I thought was the standard preparedStatement.addBatch() and preparedStatement.executeBatch() APIs.
    I see in the SetExecuteBatch.java example the use of connection.setDefaultExecuteBatch(int) and preparedStatement.executeUpdate(). Is this usage required when running in the Oracle JVM? What if I set my batch size to 10000 but I only have 9000 rows in the last set -- how do I force the batch to execute on the smaller set?

  • Problem with Batch Updates

    Hi All,
    I have a requirement where in I have to use batch updates. But if there's a problem in one of the updates, I want the rest of the updates to ingore this and continue with the next statement in the batch. Is this not one of the features in BatchUpdates in JDBC2? I have been trying to accomplish this since 2 days now. Can anyone help me with this. Can anyone please help me with this?
    FYI, I have tried the following.
    I have 3 test updates in my batch.
    2 nd statement is an erraneous statement(deliberate). Other 2 statements are fine. It is appropriatley throwing 'BatchUpdateException'. when I ckeck the "arrays of ints" reurned by executeBatch() as well as BatchUpdateException.getUpdateCounts() are returning an arrays of size '0'. If remeove the erraneous statement, behaviour is as expected.
    Thanks in advance,
    Bharani

    The next paragraph of the same API doc:
    If the driver continues processing after a failure, the array returned by the method BatchUpdateException.getUpdateCounts will contain as many elements as there are commands in the batch, and at least one of the elements will be the following:
    3. A value of -3 -- indicates that the command failed to execute successfully and occurs only if a driver continues to process commands after a command fails
    A driver is not required to implement this method.

  • JDBC Batch Updates & PreparedStatement problems (Oracle 8i)

    Hi,
    we're running into problems when trying to use JDBC Batch Updates with PreparedStatement in Oracle8i.
    First of all, Oracle throws a SQLException if one of the statements in the batch fails (e.g. because of a unique constraint violation). As far as I understand, a BatchUpdateException should be thrown?
    The next problem is much worse:
    Consider this table:
    SQL> desc oktest
    ID NOT NULL NUMBER(10)
    VALUE NOT NULL VARCHAR2(20)
    primary key is ID
    When inserting in through batch updates with a PreparedStatement, I can pass 'blah' as a value for ID without getting an exception (Oracle silently converts 'blah' to zero). Only when the offending statement is the last statement in the batch, Oracle throws an exception (again, SQLException instead of BatchUpdateException).
    Any comments/suggestions are appreciated.
    E-mail me if you want to see the code...
    Thanks,
    Oliver
    Oracle version info:
    (Enterprise Edition Release 8.1.6.0.0, JServer Release 8.1.6.0.0, Oracle JDBC driver 8.1.6.0.0 and 8.1.7.0.0 (we're using the 'thin' driver)
    CLASSPATH=/opt/oracle/product/8.1.7/jdbc/lib/classes12.zip:...
    null

    Please refer
    http://www.oracle.com/technology/products/oracle9i/daily/jun07.html

  • Facing problem in loading table using IKM Oracle Slowly Changing Dimension

    Hi,
    I am facing problem in loading dimension table using IKM Oracle Slowly Changing Dimension
    Following is the setup :-
    SRC :- source_table (MSSQL)
    Staging :- staging_table (MSSQL)
    TRGT :- target_table (Oracle)
    -------- source_table
    group_id     int
    group_version_id     int
    name     varchar (255)
    description     varchar (255)
    comments     varchar (2000)
    ref_number     varchar (255)
    is_latest_version     decimal (5)
    is_deleted     decimal (5)
    --------- target_table
    id     number (38,0) - Mapped to <%=odiRef.getObjectName( "L" , "SEQ_NAME" , "D" )%>.nextval
              - Executed on target
              - defined the column as SK in model
    group_id     number (38,0) - defined the column as NK in model     
    group_version_id     number (38,0) - defined the column as NK in model     
    name     varchar (255) - undefined on the model description
    description     varchar (255) - Add row on change
    comments     varchar (2000) - Add row on change
    ref_number     varchar (255) - Add row on change
    is_latest_version     number (1,0) - Add row on change
    is_deleted     number (1,0) - Add row on change
    start_datetime     date     - SYSDATE
                   - Executed on target
                   - Starting Timestamp
    end_datetime     date     - NULL
                   - Executed on target
                   - End Timestamp
    I am using following KM's:-
         LKM SQL to SQL
         IKM Oracle Slowly Changing Dimension
         CKM SQL
    it gives me the following error -
    920:Invalid relational operator

    Hi,
    Yes, this is a run-time error. Currently I am debugging it by checking SNP_SESS_TXT_LOG based on sess_no ID.
    Now, I get the following error.
    I just see the following in the operator:-
    911 : 42000 : java.sql.BatchUpdateException: ORA-00911: invalid character
    911 : 42000 : java.sql.SQLException: ORA-00911: invalid character
    java.sql.BatchUpdateException: ORA-00911: invalid character
         at oracle.jdbc.driver.DatabaseError.throwBatchUpdateException(DatabaseError.java:342)
         at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:10720)
         at com.sunopsis.sql.SnpsQuery.executeBatch(SnpsQuery.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.execCollOrders(SnpSessTaskSql.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTaskTrt(SnpSessTaskSql.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSqlC.treatTaskTrt(SnpSessTaskSqlC.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask(SnpSessTaskSql.java)
         at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java)
         at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java)
         at com.sunopsis.dwg.cmd.DwgCommandSession.treatCommand(DwgCommandSession.java)
         at com.sunopsis.dwg.cmd.DwgCommandBase.execute(DwgCommandBase.java)
         at com.sunopsis.dwg.cmd.e.i(e.java)
         at com.sunopsis.dwg.cmd.g.y(g.java)
         at com.sunopsis.dwg.cmd.e.run(e.java)
         at java.lang.Thread.run(Unknown Source)
    So, I do not get any idea of the exact step that is causing failure.
    Is there any setting in the operator that I am missing on?

  • Error ODDM  Versión 4.0.0.833 -- java.sql.BatchUpdateException: ORA-01722: invalid number

    Hello,
    I have a ten relational data modeler. When I export a reporting scheme I get the following error:
    java.sql.BatchUpdateException: ORA-01722: invalid number
                    at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:10296)
                    at oracle.jdbc.driver.OracleStatementWrapper.executeBatch(OracleStatementWrapper.java:216)
                    at oracle.dbtools.crest.exports.reports.RSTables.export(RSTables.java:108)
                    at oracle.dbtools.crest.exports.reports.RSRelationalModel.export(RSRelationalModel.java:28)
                    at oracle.dbtools.crest.exports.reports.ReportsHandler.export(ReportsHandler.java:123)
                    at oracle.dbtools.crest.swingui.ControllerApplication$ExportToReportsSchema$1.run(ControllerApplication.java:2055)
    Will I could help with the error?
    Logical data modeler is exported correctly
    Thanks.

    Hi,
    I've logged a bug on this.
    It seems likely that the problem has arisen because one of your tables has a non-integer value for one of its volumetric properties (Minimum, Expected or Maximum volume).
    (If this is the case, then the problem will probably still occur with the DM 4.1 EA1 version.)
    David

  • SQL0100W BatchUpdateException in DB2

    All,
    I think there is some problem with DB2 8.1 JDBC driver. I get
    SQL0100W No row was found for FETCH, UPDATE or DELETE; or the result of a query is an empty table. SQLSTATE=02000
    exception when I use preparedstatement.executeBatch() and I have only one statement in the batch [to delete a non existing row from a table]
    code snip....
    while(resultSet.next()){
    long id = resultSet.getLong("ID");
    stmt1 = connection.createStatement();
    stmt1.addBatch("DELETE FROM test WHERE ID ="+id);
    stmt1.executeBatch(); //executes successfully without any exception
    System.out.println("1Here");
    stmt = connection.prepareStatement("DELETE FROM test WHERE ID = ?");
    stmt.setLong(1,id);
    stmt.addBatch();
    stmt.executeBatch(); //throws exception SQL0100W No row was found for FETCH, UPDATE or DELETE; or the result of a
    query is an empty table. SQLSTATE=02000
    System.out.println("2Here");
    Please let me know if this is a bug in the driver implementation or some silly mistake from my side.
    Thanks in advance,
    v_d_s

    Sir,
    Well the error is telling you what you already now... ie. the row doesn't exist. So it's not really a bug. I'm not sure I would hae classified it as an Exception rather than an Warning but the API only says
    BatchUpdateException (a subclass of SQLException) if one of the commands sent to the database fails to execute properly or attempts to return a result set.
    So I guess how fails to execute properly is open to interpretation.
    Sincerely,
    Slappy

  • BatchUpdateException

    hello, there:
    I was running an jdbc-related app, and I used preparedStatement.addBatch in this app to insert data into database.
    it was fine but today I got an exception: java.sql.BatchUpdateException: Overflow Exception trying to bind NaN
    Anyone knows what causes this kind of Exception and how I can solve this problem?
    Thanks a lot,
    Sway

    It looks like you did some bad arithmetic, resulting in a "Not A Number" (NaN) result. For example:
    public class Nan {
       public static void main(String[] args) {
          float nan = 0f / 0f;
          System.out.println(nan);
    }When you then try to store that value in a floating point column, the database complains. So the problem is in your Java logic, and the database is trying to prevent you from corrupting the column!
    It's not specific to the BatchUpdate, it just happened to occur in one, and so the BatchUpdate had to report the error.
    Dave.

  • JDBC BatchUpdateException

    I have the following problem:
    If I try to insert values to a database table with a batch update and somehing goes wrong during statement.executeBatch() (e.g a unique
    constraint is violated), the Oracle driver throws a SQLException instead of an BatchUpdateException and I have no chance to get the updatecount with BatchUpdateException buex.getUpdateCounts().
    Am I wrong or is the driver buggy?
    Any ideas how I can remove the faulty batch element and commit the correct elements?
    Thanks,
    Immo
    I'm using the Oracle8i 8.1.6.0.1 JDBC 2.0 compliant driver for use with JDK 1.2.x
    This is the Exception: java.sql.SQLException: ORA-00001: unique constraint (BERND.SYS_C00946) violated

    Hi,
    I've logged a bug on this.
    It seems likely that the problem has arisen because one of your tables has a non-integer value for one of its volumetric properties (Minimum, Expected or Maximum volume).
    (If this is the case, then the problem will probably still occur with the DM 4.1 EA1 version.)
    David

  • CDC setup problem

    {noformat}Dear all,{noformat}{noformat}Trying to troubleshoot a CDC setup problem in ODI:{noformat}{noformat}I got an error when trying to "Start Journal" from the CDC source model (in Designer).{noformat}{noformat}Here is what I've done:{noformat}{noformat}1. grant the following role to the CDC source schema (user):{noformat}{noformat}DBA, execute on DBMS_CDC_PUBLISH, connect, resource, select_on_change_sets, create session, select_catalog_role, execute_catalog_role, create sequence{noformat}{noformat}2. in the CDC source model "Journalizing" tab, specify JKM 9i logminer (CDC source is on 9i) and specify "Automatic Configuration"{noformat}{noformat}3. add a subscriber "SUNOPSIS" to the source model -&gt; Changed Data Capture (Operator successfully run){noformat}{noformat}4. "add to CDC" from source model -&gt; Changed Data Capture{noformat}{noformat}5. "Start Journal" from source model -&gt; Changed Data Capture (Operator run failed with the following errors in the "create Journal" step){noformat}{noformat}
    30475 : 99999 : java.sql.BatchUpdateException: ORA-30475: feature not enabled:
    ORA-06512: at "SYS.DBMS_CDC_PUBLISH", line 298
    ORA-06512: at line 1
    30475 : 99999 : java.sql.SQLException: ORA-30475: feature not enabled:
    ORA-06512: at "SYS.DBMS_CDC_PUBLISH", line 298
    ORA-06512: at line 1
    java.sql.BatchUpdateException: ORA-30475: feature not enabled:
    ORA-06512: at "SYS.DBMS_CDC_PUBLISH", line 298
    ORA-06512: at line 1
    at oracle.jdbc.driver.DatabaseError.throwBatchUpdateException(DatabaseError.java:367)
    at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:9119)
    at com.sunopsis.sql.SnpsQuery.executeBatch(SnpsQuery.java)
    at com.sunopsis.dwg.dbobj.SnpSessTaskSql.execCollOrders(SnpSessTaskSql.java)
    at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTaskTrt(SnpSessTaskSql.java)
    at com.sunopsis.dwg.dbobj.SnpSessTaskSqlC.treatTaskTrt(SnpSessTaskSqlC.java)
    at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask(SnpSessTaskSql.java)
    at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java)
    at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java)
    {noformat}{noformat}Any idea?{noformat}{noformat} {noformat}{noformat}William Lam
    {noformat}

    Hi Cezar,
    Thanks for following up. Below is from the description tab of the "Create Journal" steps:
    LOADING:
    select     FULL_TABLE_NAME     FULL_TABLE_NAME
    from     CDCSRC.SNP_TMP_TABLE_LIST     TMP
    where     TMP.FULL_TABLE_NAME = 'CDCSRC.DEPT'
    and     not exists      (
              select     'X'
              from     CDCSRC.SNP_CDC_OBJECTS     OBJ,
                   CDCSRC.SNP_CDC_SET_TABLE     TBL
              where     TBL.FULL_TABLE_NAME          = OBJ.FULL_TABLE_NAME
              and     TBL.FULL_TABLE_NAME          = TMP.FULL_TABLE_NAME
              and     TBL.CDC_SET_NAME          = 'CDCSRC.CDCSRC'
              and     OBJ.FULL_OBJECT_NAME     = 'CDCSRC.J$DEPT'
              and     OBJ.CDC_OBJECT_TYPE          = 'JRN_FULL_NAME'
    DEFAULT:
    BEGIN
         DBMS_LOGMNR_CDC_PUBLISH.CREATE_CHANGE_TABLE(
         owner          => 'CDCSRC',
         change_table_name     => 'J$DEPT',
         change_set_name     => 'SYNC_SET',
         source_schema     => 'CDCSRC',
         source_table     => 'DEPT',
         column_type_list     => 'DEPTNO NUMBER(2) ',
         capture_values     => 'new',
         rs_id          => 'n',
         row_id          => 'n',
         user_id          => 'n',
         timestamp          => 'y',
         object_id          => 'n',
         source_colmap     => 'n',
         target_colmap     => 'n',
         options_string     => ''
    END;
    The error message from the Execution Tab:
    30475 : 99999 : java.sql.BatchUpdateException: ORA-30475: feature not enabled:
    ORA-06512: at "SYS.DBMS_CDC_PUBLISH", line 298
    ORA-06512: at line 1
    30475 : 99999 : java.sql.SQLException: ORA-30475: feature not enabled:
    ORA-06512: at "SYS.DBMS_CDC_PUBLISH", line 298
    ORA-06512: at line 1
    java.sql.BatchUpdateException: ORA-30475: feature not enabled:
    ORA-06512: at "SYS.DBMS_CDC_PUBLISH", line 298
    ORA-06512: at line 1
    Once again, the setup details:
    - CDC source is on Oracle 9i
    - KM used is Oracle 9i LogMiner
    - enabled archivelog in Oracle 9i
    - installed logminer by running the 2 sqls as described in the earlier tread.
    I need to meet a tight deadline for POC completion and I desparate need some help here.
    Thanks and regards,
    William

  • BatchUpdateException :Results returned for UPDATE ONLY.

    I got an error message at the statement stmt.executeBatch();
    java.sql.BatchUpdateException: Results returned for UPDATE ONLY.
    There are 3 SQL commands in the batch and it throws the above exception while executing the first command.
    (The first command is a SELECT command with COUNT returned to a variable
    eg. SELECT @ABC := COUNT(*) ....
    The second and the third commands use the returned variable to make updates)
    I printed out the updated information using BatchUpdateException.getUpdateCounts and I got
    -3 1 1 (-3 means Statement.EXECUTE_FAILED)
    However, I checked the database (mysql) and I discovered those two update commands were executed correctly ???!!!
    An interesting thing is: if I use stmt.execute or stmt.executeQuery instead of executeBatch, it works fine and doesn't throw any exception.
    I wonder if anybody experience similar situation before or have idea on this problem. Thanx :)

    Can somebody help me, please?

  • A trigger causes a BatchUpdateException

    Hi all.
    I have a big problem. I need to do a program that insert batch information to
    Sybase, Firts I use PreparedStatement but when I send executeBatch() command,
    throws a Exception , then I used Statement and I got the same problem.
    This problem is caused by a insert trigger configured in the sybase table. Maybe
    the driver can't distinguish between update counts from the trigger and insert
    java sentence. I dont know.
    Anybody have an idea to solve this?
    I am using WebLogic 8.1 , jConnect 5.5 and Sybase 11.9.2
    I send you the completa message exception and part of my example program.
    Error 500--Internal Server Error
    java.lang.ClassCastException
         at com.sybase.jdbc2.jdbc.SybStatement.batchLoop(SybStatement.java:1233)
         at com.sybase.jdbc2.jdbc.SybStatement.sendBatch(SybStatement.java:1089)
         at com.sybase.jdbc2.jdbc.SybStatement.executeBatch(SybStatement.java:1056)
         at com.sybase.jdbc2.jdbc.SybPreparedStatement.executeBatch(SybPreparedStatement.java:680)
         at weblogic.jdbc.wrapper.PreparedStatement_com_sybase_jdbc2_jdbc_SybPreparedStatement.executeBatch(Unknown
    Source)
         at jsp_servlet.__insertbatch._jspService(__insertbatch.java:322)
         at weblogic.servlet.jsp.JspBase.service(JspBase.java:33)
         at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:1053)
         at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:387)
         at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:431)
         at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:305)
         at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:6291)
         at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:317)
         at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:97)
         at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3575)
         at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2573)
         at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:178)
         at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:151)
    Thanks for your help.
    the code for my jsp program example is :
    try {               InitialContext env = new InitialContext();
    ds = (DataSource) env.lookup("jdbc/Envios");
    } catch(NamingException ne) {
    out.println("No pudo obtener conexión a la base de datos: " + ne + "<BR>");
    //crea la conexion
    cnx = Sql.getCnx(ds, 5000);
    Statement stmt = cnx.createStatement();
    try{
    stmt.addBatch("INSERT INTO cdHistoria VALUES('1234567880','MEX',getDate(),'1234567','MLOC','123',NULL,NULL,NULL)");
    stmt.addBatch("INSERT INTO cdHistoria VALUES('1234567881','MEX',getDate(),'1234567','MLOC','123',NULL,NULL,NULL)");
    reg = stmt.executeBatch();
    }catch(SQLException bue){%>
    Error causado por SQLException: <%=bue.getMessage()%>
    <%}
    //Obtiene los datos enviados por la forma de consulta o
    //menú principal
    //IdGuia SiglasPlaza FechaEvento Ruta TipoMov ClaveEx NumOR IdTransporte IdEmpleado
    String SQL = "INSERT INTO cdHistoria VALUES(?,'MEX',getDate(),'1234567','MLOC','123',NULL,NULL,NULL)";
    try{
    cnx.setAutoCommit(false);
    PreparedStatement st = cnx.prepareStatement(SQL);
    st.setString(1,"12345678910");
    st.addBatch();
    st.setString(1,"12345678911");
    st.addBatch();
    reg = st.executeBatch();
    cnx.commit();
    cnx.setAutoCommit(true);
    st.close();
    for (int i=0;1<reg.length;i++){ %>
    Registros agregados: <%=i%>
    <% }
    }catch(BatchUpdateException sqle){
    %>
    Error causado por SQLException: <%=sqle.getMessage()%>
    <%}catch(SQLException bue){%>
    Error causado por SQLException: <%=bue.getMessage()%>
    <%}%>

    Adrian Morales wrote:
    Hi all.
    I have a big problem. I need to do a program that insert batch information to
    Sybase, Firts I use PreparedStatement but when I send executeBatch() command,
    throws a Exception , then I used Statement and I got the same problem.
    This problem is caused by a insert trigger configured in the sybase table. Maybe
    the driver can't distinguish between update counts from the trigger and insert
    java sentence. I dont know.
    Anybody have an idea to solve this?Hi. This is a followup from a post to the sybase jdbc group. Have you tried
    the latest driver from them? The ClassCast exception is a purely Sybase
    driver internal error.
    Joe
    >
    I am using WebLogic 8.1 , jConnect 5.5 and Sybase 11.9.2
    I send you the completa message exception and part of my example program.
    Error 500--Internal Server Error
    java.lang.ClassCastException
         at com.sybase.jdbc2.jdbc.SybStatement.batchLoop(SybStatement.java:1233)
         at com.sybase.jdbc2.jdbc.SybStatement.sendBatch(SybStatement.java:1089)
         at com.sybase.jdbc2.jdbc.SybStatement.executeBatch(SybStatement.java:1056)
         at com.sybase.jdbc2.jdbc.SybPreparedStatement.executeBatch(SybPreparedStatement.java:680)
         at weblogic.jdbc.wrapper.PreparedStatement_com_sybase_jdbc2_jdbc_SybPreparedStatement.executeBatch(Unknown
    Source)
         at jsp_servlet.__insertbatch._jspService(__insertbatch.java:322)
         at weblogic.servlet.jsp.JspBase.service(JspBase.java:33)
         at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:1053)
         at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:387)
         at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:431)
         at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:305)
         at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:6291)
         at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:317)
         at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:97)
         at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3575)
         at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2573)
         at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:178)
         at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:151)
    Thanks for your help.
    the code for my jsp program example is :
    try {               InitialContext env = new InitialContext();
    ds = (DataSource) env.lookup("jdbc/Envios");
    } catch(NamingException ne) {
    out.println("No pudo obtener conexión a la base de datos: " + ne + "<BR>");
    //crea la conexion
    cnx = Sql.getCnx(ds, 5000);
    Statement stmt = cnx.createStatement();
    try{
    stmt.addBatch("INSERT INTO cdHistoria VALUES('1234567880','MEX',getDate(),'1234567','MLOC','123',NULL,NULL,NULL)");
    stmt.addBatch("INSERT INTO cdHistoria VALUES('1234567881','MEX',getDate(),'1234567','MLOC','123',NULL,NULL,NULL)");
    reg = stmt.executeBatch();
    }catch(SQLException bue){%>
    Error causado por SQLException: <%=bue.getMessage()%>
    <%}
    //Obtiene los datos enviados por la forma de consulta o
    //menú principal
    //IdGuia SiglasPlaza FechaEvento Ruta TipoMov ClaveEx NumOR IdTransporte IdEmpleado
    String SQL = "INSERT INTO cdHistoria VALUES(?,'MEX',getDate(),'1234567','MLOC','123',NULL,NULL,NULL)";
    try{
    cnx.setAutoCommit(false);
    PreparedStatement st = cnx.prepareStatement(SQL);
    st.setString(1,"12345678910");
    st.addBatch();
    st.setString(1,"12345678911");
    st.addBatch();
    reg = st.executeBatch();
    cnx.commit();
    cnx.setAutoCommit(true);
    st.close();
    for (int i=0;1<reg.length;i++){ %>
    Registros agregados: <%=i%>
    <% }
    }catch(BatchUpdateException sqle){
    %>
    Error causado por SQLException: <%=sqle.getMessage()%>
    <%}catch(SQLException bue){%>
    Error causado por SQLException: <%=bue.getMessage()%>
    <%}%>

  • Problem with update query on unique constraint(java programmer)

    Hi ,
    i created one table called mytab
    mytab there are two columns
    1)no 2)name
    no is unique
    there are two record 1 and 2
    mytab
    no name
    1 a
    2 b
    i want to update 1 record to 2
    and first record to 2
    i am using batchexecute
    str1="update mytab set no=1 where no=2"
    str2="update mytab set no=2 where no=1";
    st.addBatch(str1);
    st.addBatch(st2);
    st.executeBatch();
    and i am getting this exeception
    java.sql.BatchUpdateException: error occurred during batching: ORA-00001: unique constraint (EPRDEV.SYS_C0017184) violated
    is there any solution
    dont say change first record to null and then change it as second then so on
    why because there are so many records are there .
    other than using null as halt any other solution.
    please help
    with regards

    Well, you can almost do it. You see, although str1 will set col no to 1 where no = 2, now you will have two rows where no = 1. So str2 will update two rows to 2. If you can avoid this problem then you will use deferrable unique constraint supported by a non unique index to do what you want.
    eg.
    SQL>  create table t (no number, name varchar2(10));
    Table created.
    SQL> create index t_x on t(no);
    Index created.
    SQL> alter table t add constraint t_ux unique (no) deferrable using index;
    Table altered.
    SQL> insert into t values (1, 'a');
    1 row created.
    SQL> insert into t values (2, 'b');
    1 row created.
    SQL> commit;
    Commit complete.
    SQL> select * from t;
            NO NAME
             1 a
             2 b
    2 rows selected.
    SQL> set constraint t_ux deferred;
    Constraint set.
    SQL> update t set no = 2 where no =1;
    1 row updated.
    SQL> update t set no = 1 where no = 2;
    2 rows updated.
    SQL> rollback;
    Rollback complete.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Problem loading data from jena

    Hi, two issues when loading data into Oracle from a jena model:
    1. The incremental and batch load both works well except when we add a triple with a literal types as double:
    triple = new Triple(dirNode.asNode(), Node.createURI("http://www.w3.org/2003/01/geo/wgs84_pos#long"), Node.createLiteral(geopos.getLongitude().toString(), null,      (RDFDatatype) XSDDatatype.XSDdouble));
    graph.add(triple);
    We get the error:
    GRAVE: Could not add triple
    java.sql.BatchUpdateException: ORA-55303: Fallo en el constructor SDO_RDF_TRIPLE_S: Simple case: SQLERRM=ORA-55328: fallo al intentar insertar el valor literal "-5.9278863"^^<http://www.w3.org/2001/XMLSchema#double>
    ORA-06512: en "MDSYS.MD", línea 1723
    ORA-06512: en "MDSYS.MDERR", línea 17
    ORA-06512: en "MDSYS.SDO_RDF_TRIPLE_S", línea 211
         at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1335)
         at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3449)
         at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:3530)
         at oracle.jdbc.driver.OraclePreparedStatementWrapper.executeUpdate(OraclePreparedStatementWrapper.java:1062)
    2. The bulk load simply does not work:
    ((OracleBulkUpdateHandler) graph.getBulkUpdateHandler()).addInBulk(GraphUtil.findAll(model.getGraph()), "sem_ts");
    We get:
    01-oct-2009 13:11:39 oracle.spatial.rdf.client.jena.SimpleLog warn
    ADVERTENCIA: addInBulk: [92 ] sqle
    java.sql.SQLException: ORA-44004: nombre de SQL cualificado no válido
    ORA-06512: en "SYS.DBMS_ASSERT", línea 188
    ORA-06512: en "MDSYS.SDO_RDF", línea 242
    ORA-06512: en "MDSYS.RDF_APIS", línea 693
    ORA-06512: en línea 1
         at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:439)
         at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:395)
         at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:802)
    In both case our conexion is something like:
    public static String conexion = "jdbc:oracle:thin:user/pass@ourserver:1521:ourdb";
    Any idea? Thanks

    Hi Wu, we have included your code in a java test ang got the same problem.
    Our installation is Oracle Database 11.2.0.1.0. Then we added the 'Semantic patch' 11_2_sem and followed the instructions to create a tablespace and the RDF/SEM network. Finally we create a model as [explained here|http://download.oracle.com/docs/cd/E11882_01/appdev.112/e11828/sdo_rdf_concepts.htm#CHDEDFFA] .
    Some text in the exception is spanish; basically it seems to say 'fails inserting the literal value'... The rest of data in the app has been correctly inserted.
    This is the java test:
    public class PruebaOracleTest extends TestCase {
         String jdbcUrl = "jdbc:oracle:thin:user/pass@server:1521:bd";
         public void testInsertData() throws Exception {
              Oracle oracle = new Oracle(jdbcUrl, null, null);
              GraphOracleSem graph = new GraphOracleSem(oracle, "ARTICLES");
              ModelOracleSem model = new ModelOracleSem(graph);
              Model inMemoryJenaModel = ModelFactory.createDefaultModel();
              long lStartTime = System.currentTimeMillis();
              System.out.println("testCustomerMisc: start");
              Triple t = new Triple(Node.createURI("http://sub"), Node
                        .createURI("http://www.w3.org/2003/01/geo/wgs84_pos#long"),
                        Node.createLiteral("-5.9278863", null,
                                  (RDFDatatype) XSDDatatype.XSDdouble));
              graph.add(t);
              graph.flushAdd();
              String queryString = "SELECT * " + "WHERE { "
                        + " ?subject ?predicate ?object . " + "} ";
              Query query = QueryFactory.create(queryString);
              QueryExecution qexec = QueryExecutionFactory.create(query, model);
              ResultSet results;
                   results = qexec.execSelect();
                   ResultSetFormatter.out(System.out, results, query);
         public void testListTriples() throws Exception {
              Oracle oracle = new Oracle(jdbcUrl, null, null);
              GraphOracleSem graph = new GraphOracleSem(oracle, "ARTICLES");
              int cont = 0;
              ExtendedIterator it = graph.find(Triple.ANY);
              while (it.hasNext() && cont<100) {
                   Triple t = (Triple) it.next();
                   System.out.println(t.toString());
                   cont++;
              graph.close();
              oracle.dispose();
         public void testCleanModel() throws Exception {
              Oracle oracle = new Oracle(jdbcUrl, null, null);
              GraphOracleSem graph = new GraphOracleSem(oracle, "ARTICLES");
              ModelOracleSem model = new ModelOracleSem(graph);
              model.removeAll();
              graph.close();
              oracle.dispose();
    And this the exception we get:
    java.sql.SQLException: ORA-55303: Fallo en el constructor SDO_RDF_TRIPLE_S: Simple case: SQLERRM=ORA-55328: fallo al intentar insertar el valor literal "-5.9278863"^^<http://www.w3.org/2001/XMLSchema#double>
    ORA-06512: en "MDSYS.MD", línea 1723
    ORA-06512: en "MDSYS.MDERR", línea 17
    ORA-06512: en "MDSYS.SDO_RDF_TRIPLE_S", línea 211
         at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:439)
         at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:395)
         at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:802)
         at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:436)
         at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:186)
         at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:521)
         at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:205)
         at oracle.jdbc.driver.T4CPreparedStatement.executeForRows(T4CPreparedStatement.java:1008)
         at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1307)
         at oracle.jdbc.driver.OraclePreparedStatement.sendBatch(OraclePreparedStatement.java:3753)
         at oracle.jdbc.driver.OraclePreparedStatementWrapper.sendBatch(OraclePreparedStatementWrapper.java:1140)
         at oracle.spatial.rdf.client.jena.GraphOracleSem.flushAdd(GraphOracleSem.java:1219)
         at org.fundacionctic.ogd.data.support.PruebaOracleTest.testInsertData(PruebaOracleTest.java:42)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:597)
         at junit.framework.TestCase.runTest(TestCase.java:154)
         at junit.framework.TestCase.runBare(TestCase.java:127)
         at junit.framework.TestResult$1.protect(TestResult.java:106)
         at junit.framework.TestResult.runProtected(TestResult.java:124)
         at junit.framework.TestResult.run(TestResult.java:109)
         at junit.framework.TestCase.run(TestCase.java:118)
         at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
         at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)

Maybe you are looking for

  • Work Flow in Status Error

    Hi Experts, I have a Workflow which triggers on record update. After the start step i have 3 assignment Fields and then Some validations etc. I can see that this workflow is stopped at First assignment step Some times with Error. And when i Open the

  • Wireless Router wrt120n - Cannot get to Administrative website 192.168.1.1

    Hello, I've tried everything I know to do to get to the website but no luck as of yet.  I began to upgrade my firmware but i was told that i have to be in the administrative tool to do so.  HELP!

  • HUGE PROBLEM. C:\Program Files\Common Files\Apple\CoreFP\CoreFP.dll ISSUE.

    Ok, so after a huge Itunes update catastrophe, I've spent a week trying to install and uninstall Itunes to make it work. Now when i try to download Itunes i get C:\Program Files\Common Files\Apple\CoreFP\CoreFP.dll Verify that you have access to this

  • Sales for Parent Value of other dimensions

    I am having trouble in using the "Sales" member with a cross dimensional parent relationship.Dimensions: Account(Sales), Month, Years, Channel, Plant, Brand, Branch, Scenario, ProductI am trying to get the "Sales" amount for Total Channel, Total Plan

  • Image capture doesn't recognize iphone

    OS X 10.7.4, iphoto 11, iphone 4, ios 5.xx -I have photos on iphone that are not in photo stream, and videos as well, that I want to download -image capture does not recognize the iphone as a device when I launch it. It does not autostart even though