<?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: Thread problem in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/thread-problem/qaa-p/9491446#M3381525</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, Mark.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Thank you. That's an idea...&lt;SPAN __jive_emoticon_name="wink" __jive_macro_name="emoticon" class="jive_macro jive_macro_emoticon jive_emote" height="1" src="https://community.sap.com/1581/images/emoticons/wink.gif" width="1"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 21 Jun 2013 14:22:16 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2013-06-21T14:22:16Z</dc:date>
    <item>
      <title>Thread problem</title>
      <link>https://community.sap.com/t5/technology-q-a/thread-problem/qaq-p/9491436</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Greetings!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am a beginner at Powerbuilder .NET&amp;nbsp; and I have some concerns about threading. We are migrating an application from PB7 to PB12.5. It's a 3-tier application.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have created a WCF Service and,&amp;nbsp; in order to understand the way threads work, I've coded a very simple function, with a very basic task, which is to insert some rows in a table. Just for didatic matters, I've decided to call four instances of this function, simulating&amp;nbsp; multithreading. In this case, there would be 4 threads accessing and populating the table for me. It's not the client who's gonna do that, but WCF Service itself. This is necessary due to the fact that in my company there are a lot of data to be processed by the WCF Service and this small function would be a simple lab to work as reference eventually.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, here is the code for the main function:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;long&lt;SPAN style="font-size: 10pt; font-family: Consolas;"&gt; ll_conta&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;System&lt;SPAN style="font-size: 10pt; font-family: Consolas;"&gt;.&lt;/SPAN&gt;&lt;SPAN style="color: #008080; font-size: 10pt; font-family: Consolas;"&gt;Threading&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Consolas;"&gt;.&lt;/SPAN&gt;&lt;SPAN style="color: #008080; font-size: 10pt; font-family: Consolas;"&gt;Thread&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Consolas;"&gt; l_thread&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;System&lt;SPAN style="font-size: 10pt; font-family: Consolas;"&gt;.&lt;/SPAN&gt;&lt;SPAN style="color: #008080; font-size: 10pt; font-family: Consolas;"&gt;Threading&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Consolas;"&gt;.&lt;/SPAN&gt;&lt;SPAN style="color: #008080; font-size: 10pt; font-family: Consolas;"&gt;ThreadStart&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Consolas;"&gt; l_proc_thread&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Consolas;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;lproc_thread = uf_insert&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Consolas;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;For&lt;SPAN style="font-size: 10pt; font-family: Consolas;"&gt; ll_conta = &lt;/SPAN&gt;&lt;SPAN style="color: #808080; font-size: 10pt; font-family: Consolas;"&gt;1&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Consolas;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt; font-family: Consolas;"&gt;to&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Consolas;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #808080; font-size: 10pt; font-family: Consolas;"&gt;4&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; l_thread = &lt;SPAN style="color: #0000ff; font-size: 10pt; font-family: Consolas;"&gt;create&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Consolas;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #008080; font-size: 10pt; font-family: Consolas;"&gt;System&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Consolas;"&gt;.&lt;/SPAN&gt;&lt;SPAN style="color: #008080; font-size: 10pt; font-family: Consolas;"&gt;Threading&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Consolas;"&gt;.&lt;/SPAN&gt;&lt;SPAN style="color: #008080; font-size: 10pt; font-family: Consolas;"&gt;Thread&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Consolas;"&gt;(l_proc_thread)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; l_thread.IsBackground = &lt;SPAN style="color: #0000ff; font-size: 10pt; font-family: Consolas;"&gt;true&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; l_thread.Start()&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; l_thread.sleep(&lt;SPAN style="color: #808080; font-size: 10pt; font-family: Consolas;"&gt;500&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Consolas;"&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Next&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Consolas;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;return&lt;SPAN style="font-size: 10pt; font-family: Consolas;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #808080; font-size: 10pt; font-family: Consolas;"&gt;1&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #808080; font-size: 10pt; font-family: arial,helvetica,sans-serif;"&gt;And here is the code for uf_insert() function:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif;"&gt;long&lt;SPAN style="font-size: 10pt;"&gt; ll_conta&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif;"&gt;datetime&lt;SPAN style="font-size: 10pt;"&gt; ldt_data&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;uf_connect_db()&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Consolas;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Consolas;"&gt;For ll_conta =&lt;/SPAN&gt;&lt;SPAN style="color: #808080; font-size: 10pt; font-family: Consolas;"&gt;1&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Consolas;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt; font-family: Consolas;"&gt;to&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Consolas;"&gt;&amp;nbsp; 10000&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ldt_data = datetime(today())&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt; font-family: Consolas;"&gt;&amp;nbsp;&amp;nbsp; INSERT&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Consolas;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt; font-family: Consolas;"&gt;INTO&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Consolas;"&gt; CAD_THREAD (ID_THREAD, DS_NOME, DT_DATA) &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt; font-family: Consolas;"&gt;VALUES&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Consolas;"&gt; ( :ll_conta,&lt;/SPAN&gt;&lt;SPAN style="color: #ff0000; font-size: 10pt; font-family: Consolas;"&gt;'THREAD_TEST'&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Consolas;"&gt;, :ldt_data);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Next&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;disconnect&lt;SPAN style="font-size: 10pt; font-family: Consolas;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt; font-family: Consolas;"&gt;using&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Consolas;"&gt; sqlca;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;return&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As you can see it's a very simple routine, just for practicing. &lt;/P&gt;&lt;P&gt;The problem is, when I run the function, the 4 threads start running perfectly, but then they and stop before complete the For..Next statement.&lt;/P&gt;&lt;P&gt;When I take a look at my database I notice that only one thread inserts the 10000 rows in my table. As soon as this thread finishes and stop running, the other 3 stop as well.&lt;/P&gt;&lt;P&gt;Could&amp;nbsp; you please help me find a solution?&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;Deise&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Jun 2013 21:39:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/thread-problem/qaq-p/9491436</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2013-06-12T21:39:40Z</dc:date>
    </item>
    <item>
      <title>Re: Thread problem</title>
      <link>https://community.sap.com/t5/technology-q-a/thread-problem/qaa-p/9491437#M3381516</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;SQLCA is a global variable.&amp;nbsp; When the first thread finishes, wouldn't it disconnect SQLCA from the database and basically cut off any other threads using the same connection?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Jun 2013 03:57:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/thread-problem/qaa-p/9491437#M3381516</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2013-06-13T03:57:01Z</dc:date>
    </item>
    <item>
      <title>Re: Thread problem</title>
      <link>https://community.sap.com/t5/technology-q-a/thread-problem/qaa-p/9491438#M3381517</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, Bruce.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I took off the commandline 'disconnect using sqlca;', but it seems to be a little&amp;nbsp; trickier, because the remaining threads are stopping yet.&lt;/P&gt;&lt;P&gt;I've considered switching the database connection to the main function, but then the uf_insert() function doesn't recognize the connection.&lt;/P&gt;&lt;P&gt;Although it's a global variable, perhaps each thread holds its own&amp;nbsp; instance of the sqlca variable, doesn't it?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Jun 2013 15:55:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/thread-problem/qaa-p/9491438#M3381517</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2013-06-13T15:55:55Z</dc:date>
    </item>
    <item>
      <title>Re: Thread problem</title>
      <link>https://community.sap.com/t5/technology-q-a/thread-problem/qaa-p/9491439#M3381518</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;use a local transaction object within the method&lt;/LI&gt;&lt;LI&gt;create the connection within the method, instead of through another method&lt;/LI&gt;&lt;LI&gt;commit before you disconnect from the database&lt;/LI&gt;&lt;LI&gt;disconnect from the database within the method&lt;/LI&gt;&lt;/UL&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Jun 2013 17:23:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/thread-problem/qaa-p/9491439#M3381518</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2013-06-13T17:23:22Z</dc:date>
    </item>
    <item>
      <title>Re: Thread problem</title>
      <link>https://community.sap.com/t5/technology-q-a/thread-problem/qaa-p/9491440#M3381519</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, Bruce.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Problem solved!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #808080; font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;Here is the final code for uf_insert() function:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; =================================&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif;"&gt;long&lt;SPAN style="font-size: 10pt;"&gt; ll_conta&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif;"&gt;datetime&lt;SPAN style="font-size: 10pt;"&gt; ldt_data&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Transaction &lt;SPAN style="font-size: 10pt; font-family: Consolas;"&gt;My_sqlca&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;My_sqlca = &lt;SPAN style="color: #0000ff; font-size: 10pt; font-family: Consolas;"&gt;create&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Consolas;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #008080; font-size: 10pt; font-family: Consolas;"&gt;Transaction&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;My_sqlca.logid = &lt;SPAN style="color: #ff0000; font-size: 10pt; font-family: Consolas;"&gt;'&amp;lt;SomeId&amp;gt;'&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;My_sqlca.logpass=&lt;SPAN style="color: #ff0000; font-size: 10pt; font-family: Consolas;"&gt;'&amp;lt;SomePassword&amp;gt;'&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;My_sqlca.dbms = &lt;SPAN style="color: #ff0000; font-size: 10pt; font-family: Consolas;"&gt;'ADO.Net'&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;My_sqlca.AutoCommit = &lt;SPAN style="color: #0000ff; font-size: 10pt; font-family: Consolas;"&gt;true&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;My_sqlca.DBParm = &lt;SPAN style="color: #ff0000; font-size: 10pt; font-family: Consolas;"&gt;"Disablebind=1,Namespace='System.Data.SqlClient',DataSource='&amp;lt;MyServer&amp;gt;',Database='&amp;lt;MyDatabase&amp;gt;'"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #ff0000; font-size: 10pt; font-family: Consolas;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;connect&lt;SPAN style="font-size: 10pt; font-family: Consolas;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt; font-family: Consolas;"&gt;using&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Consolas;"&gt; My_sqlca;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: Consolas; font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; font-size: 10pt;"&gt;For ll_conta =&lt;/SPAN&gt;&lt;SPAN style="color: #808080; font-family: Consolas; font-size: 10pt;"&gt;1&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Consolas; font-size: 10pt;"&gt;to&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; font-size: 10pt;"&gt;&amp;nbsp; 10000&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ldt_data = datetime(today())&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-family: Consolas; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp; INSERT&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Consolas; font-size: 10pt;"&gt;INTO&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; font-size: 10pt;"&gt; CAD_THREAD (ID_THREAD, DS_NOME, DT_DATA) &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Consolas; font-size: 10pt;"&gt;VALUES&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; font-size: 10pt;"&gt; ( :ll_conta,&lt;/SPAN&gt;&lt;SPAN style="color: #ff0000; font-family: Consolas; font-size: 10pt;"&gt;'THREAD_TEST'&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; font-size: 10pt;"&gt;, :ldt_data) using My_sqlca;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Next&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;disconnect&lt;SPAN style="font-family: Consolas; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Consolas; font-size: 10pt;"&gt;using&lt;/SPAN&gt;&lt;SPAN style="font-family: Consolas; font-size: 10pt;"&gt; My_sqlca;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;return&lt;/P&gt;&lt;P&gt; =================================&lt;/P&gt;&lt;P&gt;By using a local transaction object, the four threads were able to run completely up to the end.&lt;/P&gt;&lt;P&gt;I was really not aware of the database connection matter.&lt;/P&gt;&lt;P&gt;Thank you very much for your help, I hope I might also be able to contribute with this forum eventually.&lt;SPAN __jive_emoticon_name="happy" __jive_macro_name="emoticon" class="jive_macro jive_macro_emoticon jive_emote" src="https://community.sap.com/1495/images/emoticons/happy.gif"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Jun 2013 19:31:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/thread-problem/qaa-p/9491440#M3381519</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2013-06-13T19:31:37Z</dc:date>
    </item>
    <item>
      <title>Re: Thread problem</title>
      <link>https://community.sap.com/t5/technology-q-a/thread-problem/qaa-p/9491441#M3381520</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Guys!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I was wondering: &lt;/P&gt;&lt;P&gt;I have a process I may or may not run by thread. &lt;/P&gt;&lt;P&gt;This means I don't always need to create a transaction object. &lt;/P&gt;&lt;P&gt;It's up to my users to set the number of threads they wish.&lt;/P&gt;&lt;P&gt; In this case I can see a problem concerning the SQLCA. &lt;/P&gt;&lt;P&gt;The objects involved have functions inherited, which uses SQLCA widely. &lt;/P&gt;&lt;P&gt;I would have to rewrite the code all over the system in order to consider MySqlca, and I still would have to consider both situations ( SQLCA and MySqlca ). &lt;/P&gt;&lt;P&gt;I have tried many approaches, but I can't see a clear solution that avoids reworking and gives me a neat code.&lt;/P&gt;&lt;P&gt; Do you have any idea to make a flexible set of routines?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Jun 2013 20:52:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/thread-problem/qaa-p/9491441#M3381520</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2013-06-20T20:52:35Z</dc:date>
    </item>
    <item>
      <title>Re: Thread problem</title>
      <link>https://community.sap.com/t5/technology-q-a/thread-problem/qaa-p/9491442#M3381521</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Deise;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; First of all WHOA!!!!!!!!!&amp;nbsp; Never, never, never (and if in doubt never) use any global variables in a multi-threaded application as you will inadvertently make the application single threaded. SQLCA is a prime example of a &lt;EM&gt;global &lt;/EM&gt;variable!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Only use &lt;SPAN style="text-decoration: underline;"&gt;instance&lt;/SPAN&gt; variables in each thread.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards ... Chris&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Jun 2013 11:15:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/thread-problem/qaa-p/9491442#M3381521</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2013-06-21T11:15:29Z</dc:date>
    </item>
    <item>
      <title>Re: Thread problem</title>
      <link>https://community.sap.com/t5/technology-q-a/thread-problem/qaa-p/9491443#M3381522</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Deise,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My first thought is you could overload your functions with a new set of functions that take a transaction object as an argument. The processes that need to be multithreaded could pass in MySqlca to the overloaded functions. The processes that don't could use the existing functions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hth,&lt;/P&gt;&lt;P&gt;Mark&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Jun 2013 12:01:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/thread-problem/qaa-p/9491443#M3381522</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2013-06-21T12:01:09Z</dc:date>
    </item>
    <item>
      <title>Re: Thread problem</title>
      <link>https://community.sap.com/t5/technology-q-a/thread-problem/qaa-p/9491444#M3381523</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The issue here is your application design and the approach you use to write your "process".&amp;nbsp; You have a process and that process needs a transaction object.&amp;nbsp; Rather than assume and use SQLCA, you simply need to provide a mechanism to control (or direct) the process to use a particular transaction object.&amp;nbsp; With that approach, you can tell the process to use SQLCA or any other transaction object you care to create.&amp;nbsp; Of course, you could also provide a mechanism that allows your process to create and manage its own transaction object.&amp;nbsp; In PFC, you will find many classes have an of_settransobject function to do exactly that. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Jun 2013 12:51:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/thread-problem/qaa-p/9491444#M3381523</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2013-06-21T12:51:04Z</dc:date>
    </item>
    <item>
      <title>Re: Thread problem</title>
      <link>https://community.sap.com/t5/technology-q-a/thread-problem/qaa-p/9491445#M3381524</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, Chris.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Yeah, I'm aware of that! &lt;SPAN __jive_emoticon_name="laugh" __jive_macro_name="emoticon" class="jive_macro jive_macro_emoticon jive_emote" height="1" src="https://community.sap.com/1581/images/emoticons/laugh.gif" width="1"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Never, ever global variables... &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;My problem is that there are&amp;nbsp; routines that switch between single and multi threading.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I believe that Mark has a good idea by suggesting&amp;nbsp; a new argument in my functions...&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Unfortunately it's going to be a very rough path ....&amp;nbsp; Once again:&amp;nbsp; "no pain, no gain"&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Jun 2013 14:00:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/thread-problem/qaa-p/9491445#M3381524</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2013-06-21T14:00:26Z</dc:date>
    </item>
    <item>
      <title>Re: Thread problem</title>
      <link>https://community.sap.com/t5/technology-q-a/thread-problem/qaa-p/9491446#M3381525</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, Mark.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Thank you. That's an idea...&lt;SPAN __jive_emoticon_name="wink" __jive_macro_name="emoticon" class="jive_macro jive_macro_emoticon jive_emote" height="1" src="https://community.sap.com/1581/images/emoticons/wink.gif" width="1"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Jun 2013 14:22:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/thread-problem/qaa-p/9491446#M3381525</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2013-06-21T14:22:16Z</dc:date>
    </item>
    <item>
      <title>Re: Thread problem</title>
      <link>https://community.sap.com/t5/technology-q-a/thread-problem/qaa-p/9491447#M3381526</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;As &lt;A _jive_internal="true" href="https://answers.sap.com/people/scott.morris2"&gt;Scott&lt;/A&gt; suggested, take a look at some of the transaction related features of &lt;A href="http://pfc.codeplex.com/"&gt;PFC&lt;/A&gt;.&amp;nbsp; One of those, as Scott mentioned, is a transaction caching service.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Another is the of_copyto method on the transaction object (&lt;A href="http://pfc.codeplex.com/SourceControl/latest#12.0/pfcmain/pfc_n_tr.sru"&gt;pfc_n_tr&lt;/A&gt;).&amp;nbsp; That allows you to easily create another transaction object with the same properties as the original.&amp;nbsp; So you could continue to use SQLCA as the definition of the transaction to use, but create local copies for actual use.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Jun 2013 14:39:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/thread-problem/qaa-p/9491447#M3381526</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2013-06-21T14:39:07Z</dc:date>
    </item>
    <item>
      <title>Re: Thread problem</title>
      <link>https://community.sap.com/t5/technology-q-a/thread-problem/qaa-p/9491448#M3381527</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, Scott.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;You've mentioned the Achilles Heel of the application.&lt;/P&gt;&lt;P&gt;It's really a matter of design.&lt;/P&gt;&lt;P&gt;We even have a non visual object of transaction class type which is associated with SQLCA in the application properties/ variable types tab, it mostly&amp;nbsp; takes care of Dbparm and Oracle connection matters.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I am taking a look at PFC,&amp;nbsp; it's really something that might work for me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you!&lt;SPAN __jive_emoticon_name="happy" __jive_macro_name="emoticon" class="jive_macro jive_macro_emoticon jive_emote" src="https://community.sap.com/1581/images/emoticons/happy.gif"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Jun 2013 16:29:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/thread-problem/qaa-p/9491448#M3381527</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2013-06-21T16:29:43Z</dc:date>
    </item>
    <item>
      <title>Re: Thread problem</title>
      <link>https://community.sap.com/t5/technology-q-a/thread-problem/qaa-p/9491449#M3381528</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, Bruce.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am taking a look at PCF and going back to the drawing board. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you!&amp;nbsp; &lt;SPAN __jive_emoticon_name="happy" __jive_macro_name="emoticon" class="jive_macro jive_macro_emoticon jive_emote" height="1" src="https://community.sap.com/1581/images/emoticons/happy.gif" width="1"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Jun 2013 16:34:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/thread-problem/qaa-p/9491449#M3381528</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2013-06-21T16:34:22Z</dc:date>
    </item>
  </channel>
</rss>

