1 Reply Latest reply: Jun 11, 2008 10:04 PM by JustinCave RSS

    unique constraint exception

    644368

      HI ,

      At a time two user login with same username and password.when two users are inserting data into database.on that time, i am getting unique constraint exception.
      Pls any body help me.
      Exception:

      DD-YYYY HH:MI:SS AM'))
      2008-06-05 10:27:38,525 DEBUG com.sns.aws.log - AWARES: insertALERTRecord() - Exception
      java.sql.SQLException: ORA-00001: unique constraint (AWSOWNER.PK_TAWS_AWARES_ALERT) violated



      at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:187)
      at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:241)
      at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:543)
      at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1477)
      at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java:888)
      at oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java:2030)
      at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java:1950)
      at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2591)
      at oracle.jdbc.driver.OracleStatement.executeUpdate(OracleStatement.java:999)
      at weblogic.jdbc.wrapper.Statement.executeUpdate(Statement.java:336)
      at com.sns.eoffice.awares.AWARESBaseServlet.insertALERTRecord(AWARESBaseServlet.java:86)
      at com.sns.eoffice.awares.AwaresMainServlet.SendMessage(Unknown Source)
      at com.sns.eoffice.awares.AwaresMainServlet.doPost(Unknown Source)
      at com.sns.eoffice.portal.servlet.PortalServiceServlet.dispatchMethod(PortalServiceServlet.java:1008)
      at com.sns.eoffice.portal.servlet.PortalServiceServlet.service(PortalServiceServlet.java:48)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
      at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:971)
      at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:402)
      at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:305)
      at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:6350)
      at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:317)
      at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:118)
      at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3635)
      at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2585)
      at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
      at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)

        • 1. Re: unique constraint exception
          JustinCave
          What table and columns is PK_TAWS_AWARES_ALERT declared on?
          Why are the two sessions trying to insert duplicate records? Would it be possible to use something else to generate primary keys (like an Oracle sequence) that is guaranteed to be unique?

          Justin