<?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>topic Re: Retry DB connection in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/Retry-DB-connection/m-p/2197100#M990</link>
    <description>&lt;P&gt;Hello, I could solve the problem:&lt;/P&gt;&lt;P&gt;this is the correct code:&lt;/P&gt;&lt;PRE&gt;try{  

if ( ((Integer)globalMap.get("tLoop_1_CURRENT_ITERATION"))!=null&amp;amp;&amp;amp;((Integer)globalMap.get("tLoop_1_CURRENT_ITERATION")) &amp;gt; 1)
{	
	Thread.sleep(10000);
}

}catch(Exception e){
	if (((Integer)globalMap.get("tLoop_1_CURRENT_ITERATION"))!=null&amp;amp;&amp;amp;((Integer)globalMap.get("tLoop_1_CURRENT_ITERATION")) &amp;gt; 50)
	{
		context.continueLooping = false;
	}
	else
	{
		System.out.println("Tentativa n°: "+((Integer)globalMap.get("tLoop_1_CURRENT_ITERATION")));
	}
}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 03 May 2019 17:04:13 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2019-05-03T17:04:13Z</dc:date>
    <item>
      <title>Retry DB connection</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Retry-DB-connection/m-p/2197097#M987</link>
      <description>&lt;P&gt;Hello !&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;how can I retry a database connection once the first time it failure ? I mean, is there a kind of loop to keep trying connecting the database until a success connection?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best Regards!!&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 05:56:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Retry-DB-connection/m-p/2197097#M987</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-11-16T05:56:01Z</dc:date>
    </item>
    <item>
      <title>Re: Retry DB connection</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Retry-DB-connection/m-p/2197098#M988</link>
      <description>&lt;P&gt;You can establish a loop to determine if the connection to database is successful. You will find more info in the below link.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.barmartland.com/retry-failed-connections-in-talend/" target="_blank" rel="nofollow noopener noreferrer"&gt;https://www.barmartland.com/retry-failed-connections-in-talend/&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 03 May 2019 14:46:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Retry-DB-connection/m-p/2197098#M988</guid>
      <dc:creator>desanip</dc:creator>
      <dc:date>2019-05-03T14:46:27Z</dc:date>
    </item>
    <item>
      <title>Re: Retry DB connection</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Retry-DB-connection/m-p/2197099#M989</link>
      <description>&lt;P&gt;hello,&lt;/P&gt;
&lt;P&gt;tks!&lt;/P&gt;
&lt;P&gt;I don't know What I am doing wrong I have followed all instruction but I got this errors&lt;/P&gt;
&lt;PRE&gt;Starting job Customers at 12:16 03/05/2019.
[statistics] connecting to socket on port 3822
[statistics] connected
Exception in component tJavaFlex_2 (Customers)
java.lang.NullPointerException
	at local_project.customers_1_0.Customers.tLoop_1Process(Customers.java:790)
	at local_project.customers_1_0.Customers.tJava_1Process(Customers.java:482)
	at local_project.customers_1_0.Customers.runJobInTOS(Customers.java:1220)
	at local_project.customers_1_0.Customers.main(Customers.java:1054)
[statistics] disconnected

Job Customers ended at 12:16 03/05/2019. [exit code=1]&lt;/PRE&gt;
&lt;P&gt;I am using this code:&lt;/P&gt;
&lt;PRE&gt;// start part of your Java code
try{  
// here is the main part of the component,
// a piece of code executed in the row
// loop
if (((Integer)globalMap.get("tLoop_1_CURRENT_INTERATION")) &amp;gt; 1)
{	
	Thread.sleep(1500);
}
// end of the component, outside/closing the loop
}catch(Exception e){
	if (((Integer)globalMap.get("tLoop_1_CURRENT_INTERATION")) &amp;gt; 5)
	{
		context.continueLooping = false;
	}
	else
	{
		System.out.println("Connection failed. Retrying..");
	}
}&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Java error talend.PNG" style="width: 924px;"&gt;&lt;IMG src="https://yutwg22796.i.lithium.com/t5/image/serverpage/image-id/18610iD50DEB391BCF0EA0/image-size/large?v=1.0&amp;amp;px=999" title="Java error talend.PNG" alt="Java error talend.PNG" /&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 03 May 2019 16:29:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Retry-DB-connection/m-p/2197099#M989</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-05-03T16:29:06Z</dc:date>
    </item>
    <item>
      <title>Re: Retry DB connection</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Retry-DB-connection/m-p/2197100#M990</link>
      <description>&lt;P&gt;Hello, I could solve the problem:&lt;/P&gt;&lt;P&gt;this is the correct code:&lt;/P&gt;&lt;PRE&gt;try{  

if ( ((Integer)globalMap.get("tLoop_1_CURRENT_ITERATION"))!=null&amp;amp;&amp;amp;((Integer)globalMap.get("tLoop_1_CURRENT_ITERATION")) &amp;gt; 1)
{	
	Thread.sleep(10000);
}

}catch(Exception e){
	if (((Integer)globalMap.get("tLoop_1_CURRENT_ITERATION"))!=null&amp;amp;&amp;amp;((Integer)globalMap.get("tLoop_1_CURRENT_ITERATION")) &amp;gt; 50)
	{
		context.continueLooping = false;
	}
	else
	{
		System.out.println("Tentativa n°: "+((Integer)globalMap.get("tLoop_1_CURRENT_ITERATION")));
	}
}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 03 May 2019 17:04:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Retry-DB-connection/m-p/2197100#M990</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-05-03T17:04:13Z</dc:date>
    </item>
  </channel>
</rss>

