6 Replies Latest reply: Mar 4, 2013 3:17 AM by 992449 RSS

    Modification of behaviour on executeUpdate ojdbc5

    992449

      Hello,

      On the project i'm working on now there is a place where an executeUpdate(request) is producing an ORA-01008 since it's using ojdbc5 (was ojdbc14 before).
      This executeUpdate was not properly use as it is done after a prepareStatement(request)/binding/executeUpdate() but without rebinf variables as the same values are used. This way to proceed is of course not the best but it was ok with ojdbc14.
      I would like to know if somebody encounter this kid of differences on other class or method in ojdb5 ?

        • 1. Re: Modification of behaviour on executeUpdate ojdbc5
          rp0428
          We can't debug code that we can't see.

          Post the code that you are using and info about the OS and JDK versions.
          • 2. Re: Modification of behaviour on executeUpdate ojdbc5
            992449
            ...
            ps = conn.prepareStatement(req1);
            ps.setLong(1, oid);
            ps.setLong(2, ts);
            if ( ps.executeUpdate() > 0 )
            {
            ps.executeUpdate(req2); // error ORA-01008 here
            }
            ....

            I made a fix using two separate PS, but this was working fine before migration on ojdbc5.
            So i'm wondering if there is other methods or classes that change of behaviour in ojdbc5 (?)

            Edited by: 989446 on 22 févr. 2013 16:32

            Edited by: 989446 on 22 févr. 2013 16:53
            • 3. Re: Modification of behaviour on executeUpdate ojdbc5
              992449
              and we are on windows and jdk1.5.0_16
              • 4. Re: Modification of behaviour on executeUpdate ojdbc5
                rp0428
                >
                ps = conn.prepareStatement(req1);
                ps.setLong(1, oid);
                ps.setLong(2, ts);
                if ( ps.executeUpdate() > 0 )
                {
                ps.executeUpdate(req2); // error ORA-01008 here
                >
                There are no queries or bind variables shown in that.

                I take that to mean you just don't want to post the code you are using.

                Good luck with your problem.
                • 5. Re: Modification of behaviour on executeUpdate ojdbc5
                  Joe Weinstein-Oracle
                  What you are banking on in your code is a quirk in the way most JDBC drivers have implemented the
                  spec. Your code is first executing a PreparedStatement, as-prepared. Then conditionally you are
                  asking the PreparedStatement to execute a second ad-hoc unprepared update. Now, by the basic
                  spec, a PreparedStatement is a Statement, so it should inherit all the plain Statement methods,
                  such as executeUpdate(String sql), but most drivers have not allowed that to happen, or not even
                  considered it.

                  I highly recommend you change your code to do the two updates with different statements.
                  HTH,
                  Joe
                  • 6. Re: Modification of behaviour on executeUpdate ojdbc5
                    992449
                    Hello,

                    First thanks for your answer.

                    I did already correct the code, it was indeed a obvious mistake from my point of view and I correct it by using two distinct PreparedStatement.
                    My actual concern is that it was working well before we switch to the new driver. So we have to do a check among the code for points of this kind that could have change of behaviour. So I wonder if there is a kind of list of these points somewhere (didn't find so far) or if somebody have some specific experience about this, this was the point of my original post.

                    Regards