<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>Question Re: Calling an EXTERNAL ENVIRONMENT FUNCTION seems to automatically do a COMMIT in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/calling-an-external-environment-function-seems-to-automatically-do-a-commit/qaa-p/13830246#M4861089</link>
    <description>&lt;P&gt;This looks like this is most likely tied to the server-side &lt;A href="http://dcx.sap.com/index.html#sqla170/en/html/fdb9c1e166c841f2b0a20ade151a9051.html"&gt;"auto_commit"&lt;/A&gt; option; a &lt;A href="http://dcx.sap.com/index.html#sqla170/en/html/b28cc1d4c5df4eb6a2d2fe4aa269955d.html"&gt;new feature of version 17&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;I'm still researching how that is actually working under the covers and will cycle back around when I find out more.&lt;/P&gt;</description>
    <pubDate>Tue, 09 Aug 2016 10:25:45 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2016-08-09T10:25:45Z</dc:date>
    <item>
      <title>Calling an EXTERNAL ENVIRONMENT FUNCTION seems to automatically do a COMMIT</title>
      <link>https://community.sap.com/t5/technology-q-a/calling-an-external-environment-function-seems-to-automatically-do-a-commit/qaq-p/13830240</link>
      <description>&lt;P&gt;I understand that the CREATE FUNCTION statement implies an "Automatic commit", but I have a situation where simply calling the function automatically commits the transaction.&lt;/P&gt;
&lt;P&gt;It seems to be related to the fact that the function calls the Java EXTERNAL ENVIRONMENT.
For example, with the Java code as:
&lt;/P&gt;&lt;PRE&gt;public class Test {
    public static String jtest() {
        return "jTEST";
    }
    public static void main(String[] args) {
        System.out.println( jtest() );
    }
}
&lt;/PRE&gt;
and the SQL code as:
&lt;PRE&gt;INSTALL JAVA UPDATE FROM FILE 'D:/eclipse_workspace/TEST/bin/Test.class';&lt;P&gt;&lt;/P&gt;
&lt;P&gt;CREATE OR REPLACE FUNCTION jtest()
RETURNS LONG VARCHAR
EXTERNAL NAME 'Test.jtest()Ljava/lang.String;'
LANGUAGE JAVA;
&lt;/P&gt;&lt;/PRE&gt;
you can run the test:
&lt;PRE&gt;CREATE OR REPLACE TABLE TEST(
    VAL LONG VARCHAR
);
SELECT * FROM TEST;
INSERT INTO TEST VALUES(123);
SELECT * FROM TEST;
SELECT jtest();
ROLLBACK;
SELECT * FROM TEST;
&lt;/PRE&gt;
I would expect the last SELECT to return no rows; however, the inserted row has been committed.&lt;P&gt;&lt;/P&gt;
&lt;P&gt;If you run the test without the calling the external environment function (i.e., comment out the &lt;EM&gt;SELECT jtest();&lt;/EM&gt; statement), the transaction is rolled back as expected.&lt;/P&gt;
&lt;P&gt;I'm running SQL Anywhere 17.0.4.2053 on Windows 7.&lt;/P&gt;
&lt;P&gt;Can anyone explain this behaviour?  What am I missing?&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;</description>
      <pubDate>Fri, 05 Aug 2016 11:32:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/calling-an-external-environment-function-seems-to-automatically-do-a-commit/qaq-p/13830240</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2016-08-05T11:32:34Z</dc:date>
    </item>
    <item>
      <title>Re: Calling an EXTERNAL ENVIRONMENT FUNCTION seems to automatically do a COMMIT</title>
      <link>https://community.sap.com/t5/technology-q-a/calling-an-external-environment-function-seems-to-automatically-do-a-commit/qaa-p/13830242#M4861085</link>
      <description>&lt;P&gt;I can reproduce this ... and will look into it more ...&lt;/P&gt;
&lt;P&gt;I suspect this was also possible in 17.0.0 GA ... can you confirm what you're experience there was?&lt;/P&gt;</description>
      <pubDate>Fri, 05 Aug 2016 13:19:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/calling-an-external-environment-function-seems-to-automatically-do-a-commit/qaa-p/13830242#M4861085</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2016-08-05T13:19:23Z</dc:date>
    </item>
    <item>
      <title>Re: Calling an EXTERNAL ENVIRONMENT FUNCTION seems to automatically do a COMMIT</title>
      <link>https://community.sap.com/t5/technology-q-a/calling-an-external-environment-function-seems-to-automatically-do-a-commit/qaa-p/13830243#M4861086</link>
      <description>&lt;P&gt;Sorry Nick - don't have that version available.&lt;/P&gt;
&lt;P&gt;However, I just installed SA 16.0.0.2043 and tried it there and it works properly, i.e., the ROLLBACK in fact rolls back the transaction even when doing the call to jtest().  Seems the behaviour change happened after that version.&lt;/P&gt;</description>
      <pubDate>Fri, 05 Aug 2016 13:48:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/calling-an-external-environment-function-seems-to-automatically-do-a-commit/qaa-p/13830243#M4861086</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2016-08-05T13:48:27Z</dc:date>
    </item>
    <item>
      <title>Re: Calling an EXTERNAL ENVIRONMENT FUNCTION seems to automatically do a COMMIT</title>
      <link>https://community.sap.com/t5/technology-q-a/calling-an-external-environment-function-seems-to-automatically-do-a-commit/qaa-p/13830244#M4861087</link>
      <description>&lt;P&gt;Nick, I realized I had a linux version of 17.0.0.1358 available under virtualbox and tried it there - it worked properly there too ( i.e., the ROLLBACK in fact rolls back the transaction even when doing the call to jtest().)&lt;/P&gt;</description>
      <pubDate>Sun, 07 Aug 2016 23:25:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/calling-an-external-environment-function-seems-to-automatically-do-a-commit/qaa-p/13830244#M4861087</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2016-08-07T23:25:01Z</dc:date>
    </item>
    <item>
      <title>Re: Calling an EXTERNAL ENVIRONMENT FUNCTION seems to automatically do a COMMIT</title>
      <link>https://community.sap.com/t5/technology-q-a/calling-an-external-environment-function-seems-to-automatically-do-a-commit/qaa-p/13830245#M4861088</link>
      <description>&lt;P&gt;Thanks for letting us know ... With the limited cycles here, having fewer things to narrow down goes a log way ...&lt;/P&gt;</description>
      <pubDate>Mon, 08 Aug 2016 18:04:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/calling-an-external-environment-function-seems-to-automatically-do-a-commit/qaa-p/13830245#M4861088</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2016-08-08T18:04:31Z</dc:date>
    </item>
    <item>
      <title>Re: Calling an EXTERNAL ENVIRONMENT FUNCTION seems to automatically do a COMMIT</title>
      <link>https://community.sap.com/t5/technology-q-a/calling-an-external-environment-function-seems-to-automatically-do-a-commit/qaa-p/13830246#M4861089</link>
      <description>&lt;P&gt;This looks like this is most likely tied to the server-side &lt;A href="http://dcx.sap.com/index.html#sqla170/en/html/fdb9c1e166c841f2b0a20ade151a9051.html"&gt;"auto_commit"&lt;/A&gt; option; a &lt;A href="http://dcx.sap.com/index.html#sqla170/en/html/b28cc1d4c5df4eb6a2d2fe4aa269955d.html"&gt;new feature of version 17&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;I'm still researching how that is actually working under the covers and will cycle back around when I find out more.&lt;/P&gt;</description>
      <pubDate>Tue, 09 Aug 2016 10:25:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/calling-an-external-environment-function-seems-to-automatically-do-a-commit/qaa-p/13830246#M4861089</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2016-08-09T10:25:45Z</dc:date>
    </item>
    <item>
      <title>Re: Calling an EXTERNAL ENVIRONMENT FUNCTION seems to automatically do a COMMIT</title>
      <link>https://community.sap.com/t5/technology-q-a/calling-an-external-environment-function-seems-to-automatically-do-a-commit/qaa-p/13830247#M4861090</link>
      <description>&lt;P&gt;&amp;gt; ...server-side "auto_commit"; a new feature...&lt;/P&gt;
&lt;P&gt;At least The Watcom Rule is in force (the default is 'Off') but seriously?&lt;/P&gt;
&lt;P&gt;Does the world really need another way to autocommit?&lt;/P&gt;
&lt;P&gt;&lt;IMG width="300" src="https://cdn.meme.am/instances/32274401.jpg" /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Aug 2016 13:50:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/calling-an-external-environment-function-seems-to-automatically-do-a-commit/qaa-p/13830247#M4861090</guid>
      <dc:creator>Breck_Carter</dc:creator>
      <dc:date>2016-08-09T13:50:38Z</dc:date>
    </item>
    <item>
      <title>Re: Calling an EXTERNAL ENVIRONMENT FUNCTION seems to automatically do a COMMIT</title>
      <link>https://community.sap.com/t5/technology-q-a/calling-an-external-environment-function-seems-to-automatically-do-a-commit/qaa-p/13830248#M4861091</link>
      <description>&lt;P&gt;Nick, I know it's been a while, but I just installed version 17.0.8.4046 and it seems this issue still exists (I had been using version 17.0.0.1358 for development which does not have the issue).&lt;/P&gt;
&lt;P&gt;Has there been a resolution, or am I stuck with installing an older version in production too?&lt;/P&gt;</description>
      <pubDate>Fri, 27 Oct 2017 15:50:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/calling-an-external-environment-function-seems-to-automatically-do-a-commit/qaa-p/13830248#M4861091</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2017-10-27T15:50:03Z</dc:date>
    </item>
    <item>
      <title>Re: Calling an EXTERNAL ENVIRONMENT FUNCTION seems to automatically do a COMMIT</title>
      <link>https://community.sap.com/t5/technology-q-a/calling-an-external-environment-function-seems-to-automatically-do-a-commit/qaa-p/13830249#M4861092</link>
      <description>&lt;P&gt;Have you tried to use the new ClientAutocommit connection parameter introduced in build 17.0.4.2087?&lt;/P&gt;
&lt;P&gt;Note, I don't know if this is related to your issue at all, it's just a very wild guess.  Please refer to the changes to auto commit mode made in that build.&lt;/P&gt;</description>
      <pubDate>Thu, 02 Nov 2017 08:22:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/calling-an-external-environment-function-seems-to-automatically-do-a-commit/qaa-p/13830249#M4861092</guid>
      <dc:creator>VolkerBarth</dc:creator>
      <dc:date>2017-11-02T08:22:06Z</dc:date>
    </item>
    <item>
      <title>Re: Calling an EXTERNAL ENVIRONMENT FUNCTION seems to automatically do a COMMIT</title>
      <link>https://community.sap.com/t5/technology-q-a/calling-an-external-environment-function-seems-to-automatically-do-a-commit/qaa-p/13830250#M4861093</link>
      <description>&lt;P&gt;I can't seem to find docs on that parameter.  Do you have the link to the DocCommentXchange description?&lt;/P&gt;</description>
      <pubDate>Thu, 02 Nov 2017 16:27:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/calling-an-external-environment-function-seems-to-automatically-do-a-commit/qaa-p/13830250#M4861093</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2017-11-02T16:27:16Z</dc:date>
    </item>
    <item>
      <title>Re: Calling an EXTERNAL ENVIRONMENT FUNCTION seems to automatically do a COMMIT</title>
      <link>https://community.sap.com/t5/technology-q-a/calling-an-external-environment-function-seems-to-automatically-do-a-commit/qaa-p/13830251#M4861094</link>
      <description>&lt;P&gt;You can find the read me files online here:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://sqlasupport.sap.com/readme/index.html"&gt;http://sqlasupport.sap.com/readme/index.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;I took the information from there...&lt;/P&gt;</description>
      <pubDate>Thu, 02 Nov 2017 17:59:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/calling-an-external-environment-function-seems-to-automatically-do-a-commit/qaa-p/13830251#M4861094</guid>
      <dc:creator>VolkerBarth</dc:creator>
      <dc:date>2017-11-02T17:59:00Z</dc:date>
    </item>
    <item>
      <title>Re: Calling an EXTERNAL ENVIRONMENT FUNCTION seems to automatically do a COMMIT</title>
      <link>https://community.sap.com/t5/technology-q-a/calling-an-external-environment-function-seems-to-automatically-do-a-commit/qaa-p/13830241#M4861084</link>
      <description>&lt;P&gt;To workaround this issue, issue a START EXTERNAL ENVIRONMENT JAVA rather than having it started as needed.&lt;/P&gt;</description>
      <pubDate>Fri, 03 Nov 2017 10:59:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/calling-an-external-environment-function-seems-to-automatically-do-a-commit/qaa-p/13830241#M4861084</guid>
      <dc:creator>chris_keating</dc:creator>
      <dc:date>2017-11-03T10:59:16Z</dc:date>
    </item>
    <item>
      <title>Re: Calling an EXTERNAL ENVIRONMENT FUNCTION seems to automatically do a COMMIT</title>
      <link>https://community.sap.com/t5/technology-q-a/calling-an-external-environment-function-seems-to-automatically-do-a-commit/qaa-p/13830252#M4861095</link>
      <description>&lt;P&gt;Could you tell more about that workaround and its effect?&lt;/P&gt;</description>
      <pubDate>Fri, 03 Nov 2017 11:21:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/calling-an-external-environment-function-seems-to-automatically-do-a-commit/qaa-p/13830252#M4861095</guid>
      <dc:creator>VolkerBarth</dc:creator>
      <dc:date>2017-11-03T11:21:05Z</dc:date>
    </item>
    <item>
      <title>Re: Calling an EXTERNAL ENVIRONMENT FUNCTION seems to automatically do a COMMIT</title>
      <link>https://community.sap.com/t5/technology-q-a/calling-an-external-environment-function-seems-to-automatically-do-a-commit/qaa-p/13830253#M4861096</link>
      <description>&lt;P&gt;When should this be done?  When database is started? On each connection?&lt;/P&gt;</description>
      <pubDate>Fri, 03 Nov 2017 13:17:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/calling-an-external-environment-function-seems-to-automatically-do-a-commit/qaa-p/13830253#M4861096</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2017-11-03T13:17:26Z</dc:date>
    </item>
    <item>
      <title>Re: Calling an EXTERNAL ENVIRONMENT FUNCTION seems to automatically do a COMMIT</title>
      <link>https://community.sap.com/t5/technology-q-a/calling-an-external-environment-function-seems-to-automatically-do-a-commit/qaa-p/13830254#M4861097</link>
      <description>&lt;P&gt;I am still investigating the root cause. I believe it may be related to a change made on or about the release of 17.0.4 in which a fix introduced an internal commit in the external environment. Technically, the STOP EXTERNAL ENVIRONMENT is what we need to avoid to workaround the issue and that can be done by explicitly starting the external environment versus allowing the server to invoke the external environment as needed. The workaround will result in a longer lifetime for the given external environment.&lt;/P&gt;
&lt;P&gt;The JAVA external environment is launched as one-per-database. I would add the workaround in an DatabaseStart event so that in the future it could be easily disabled and removed when and if it is no longer needed. A one per database external environment is terminated when the database is stopped so there is not a need to stop the environment manually.&lt;/P&gt;
&lt;P&gt;if your server must avoid the longer lifetime, you could narrow the scope to the transactions where the external environment is invoked. This would be more involved and potentially prone to more errors.&lt;/P&gt;</description>
      <pubDate>Fri, 03 Nov 2017 14:00:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/calling-an-external-environment-function-seems-to-automatically-do-a-commit/qaa-p/13830254#M4861097</guid>
      <dc:creator>chris_keating</dc:creator>
      <dc:date>2017-11-03T14:00:47Z</dc:date>
    </item>
    <item>
      <title>Re: Calling an EXTERNAL ENVIRONMENT FUNCTION seems to automatically do a COMMIT</title>
      <link>https://community.sap.com/t5/technology-q-a/calling-an-external-environment-function-seems-to-automatically-do-a-commit/qaa-p/13830255#M4861098</link>
      <description>&lt;P&gt;Thanks Chris.  I tried executing START EXTERNAL ENVIRONMENT JAVA in Database Start event but it doesn't seem to fix it - I tried starting the environment in a User Connect event, still no luck - I then tried it as part of by TEST script - still does a commit.&lt;/P&gt;
&lt;P&gt;However, I did see one thing I might have missed before.  If I run the test script twice, the first run seems to automatically commit as in the OP, but the second and subsequent runs seem to rollback as desired.&lt;/P&gt;
&lt;P&gt;I'm running these tests on version SQL Anywhere version 17.0.8.4046 on Ubuntu 14.04.5 LTS&lt;/P&gt;</description>
      <pubDate>Fri, 03 Nov 2017 15:02:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/calling-an-external-environment-function-seems-to-automatically-do-a-commit/qaa-p/13830255#M4861098</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2017-11-03T15:02:06Z</dc:date>
    </item>
    <item>
      <title>Re: Calling an EXTERNAL ENVIRONMENT FUNCTION seems to automatically do a COMMIT</title>
      <link>https://community.sap.com/t5/technology-q-a/calling-an-external-environment-function-seems-to-automatically-do-a-commit/qaa-p/13830256#M4861099</link>
      <description>&lt;P&gt;Let me look into this further. The workaround appears to work consistently for me but I had not specifically tested the implementation I suggested.&lt;/P&gt;</description>
      <pubDate>Fri, 03 Nov 2017 15:04:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/calling-an-external-environment-function-seems-to-automatically-do-a-commit/qaa-p/13830256#M4861099</guid>
      <dc:creator>chris_keating</dc:creator>
      <dc:date>2017-11-03T15:04:46Z</dc:date>
    </item>
    <item>
      <title>Re: Calling an EXTERNAL ENVIRONMENT FUNCTION seems to automatically do a COMMIT</title>
      <link>https://community.sap.com/t5/technology-q-a/calling-an-external-environment-function-seems-to-automatically-do-a-commit/qaa-p/13830257#M4861100</link>
      <description>&lt;P&gt;I have tested with the following event:&lt;/P&gt;
&lt;P&gt;create event WorkaroundExtEnvCommit type DatabaseStart
handler
begin
    message '*** Issue START EXTERNAL ENVIRONMENT JAVA as a workaround';
    start external environment java
end;&lt;/P&gt;
&lt;P&gt;and it does workaround the issue. I use the message to confirm that the event was fired (it is sent to the engine console output).    &lt;/P&gt;
&lt;P&gt;I am running Windows 17.0.8.4075 but I do not think that this is build or platform specific.  I will try on a Linux environment to confirm the behavior.&lt;/P&gt;</description>
      <pubDate>Wed, 08 Nov 2017 20:13:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/calling-an-external-environment-function-seems-to-automatically-do-a-commit/qaa-p/13830257#M4861100</guid>
      <dc:creator>chris_keating</dc:creator>
      <dc:date>2017-11-08T20:13:39Z</dc:date>
    </item>
    <item>
      <title>Re: Calling an EXTERNAL ENVIRONMENT FUNCTION seems to automatically do a COMMIT</title>
      <link>https://community.sap.com/t5/technology-q-a/calling-an-external-environment-function-seems-to-automatically-do-a-commit/qaa-p/13830258#M4861101</link>
      <description>&lt;P&gt;Well, I don't know what I did wrong when I tried it before, but I used your code now and it worked perfectly.  Sorry for that.  It's nice to have a work-around, especially one as simple as that!  Thanks for your efforts.  If you change this to an answer, I can then accept it.&lt;/P&gt;</description>
      <pubDate>Wed, 08 Nov 2017 21:52:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/calling-an-external-environment-function-seems-to-automatically-do-a-commit/qaa-p/13830258#M4861101</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2017-11-08T21:52:53Z</dc:date>
    </item>
    <item>
      <title>Re: Calling an EXTERNAL ENVIRONMENT FUNCTION seems to automatically do a COMMIT</title>
      <link>https://community.sap.com/t5/technology-q-a/calling-an-external-environment-function-seems-to-automatically-do-a-commit/qaa-p/13830259#M4861102</link>
      <description>&lt;P&gt;We have been digging into this issue and are finding the workaround not be as reliable as initially thought. Rather than create a discussion here on options, I would like to propose that you contact me by email so that I can offer other suggestions and once we find a suitable solution post a complete workaround method to close this thread.  My email is {first}.{last}&lt;A href="http://sqlanywhere-forum.sap.com/users/1503/sap-dev"&gt;@sap&lt;/A&gt;.com.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Nov 2017 14:58:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/calling-an-external-environment-function-seems-to-automatically-do-a-commit/qaa-p/13830259#M4861102</guid>
      <dc:creator>chris_keating</dc:creator>
      <dc:date>2017-11-09T14:58:21Z</dc:date>
    </item>
  </channel>
</rss>

