<?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 Executing series of data pulls in scheduled scripts when one or more DB servers are down in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Executing-series-of-data-pulls-in-scheduled-scripts-when-one-or/m-p/430591#M68034</link>
    <description>&lt;P&gt;All,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a script that pulls various databases around the world. This script is scheduled and automated. Meaning that it does what it does, saves all the tables, closes JMP and task is then finished.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, from time to time one or two DBs are unresponsive. LDAP server is down and doesn't accept my password, or some DB maintenance etc.&lt;/P&gt;&lt;P&gt;In this case I get a pop-up window like that:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="Screenshot 2021-10-26 153937.png" style="width: 344px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/37036iACDAB69A4568F29F/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2021-10-26 153937.png" alt="Screenshot 2021-10-26 153937.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Even if I'm there when this happens and click "Cancel", the script exits without completing.&lt;/P&gt;&lt;P&gt;I have the function that pulls the data from DB encapsulated in try\catch block - doesn't seem to help when I manually click the "Cancel" button... But more importantly - how do I run script unsupervised in this case? How do I tell it - if you can't connect to one of the DBs - let it go, pull data from the rest of the DBs and process what you have... Don't hang up the whole script only because one of the DBs is unresponsive... How do I get rid of that pop up window and just consider it failed try, move to catch block and go on with the script?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's portion of the script that is responsible for this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;DBPaths = [
	"Server1" =&amp;gt; "ODBC:DSN=...PORT=5432;",
	"Server2" =&amp;gt; "ODBC:DSN=...PORT=5432;",
	"Server3" =&amp;gt; "ODBC:DSN=...PORT=5432;",
	"Server4" =&amp;gt; "ODBC:DSN=...PORT=5432;",
	"Server5" =&amp;gt; "ODBC:DSN=...PORT=5432;"];


myQuery = Function( {serverDBPath, server}, 

	New SQL Query(
		Version( 130 ),
		Connection( serverDBPath ),
		QueryName( server ),
		Select( ... ),
		From( ... ),
		Where( ... ),
		PostQueryScript( ... )
	) &amp;lt;&amp;lt; Run Foreground()
);

myDTs = {};

For Each( {{server, DBPath}, index}, DBPaths,
	Show( server, DBPath, index );
	Try( myDTs[index] = myQuery( DBPath, server ), writeToLog( server || " Query error... Using: " || DBPath ||" Error message: "||exception_msg[1] ) );
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Thanks,&amp;nbsp;&lt;/P&gt;&lt;P&gt;M.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 10 Jun 2023 20:47:26 GMT</pubDate>
    <dc:creator>miguello</dc:creator>
    <dc:date>2023-06-10T20:47:26Z</dc:date>
    <item>
      <title>Executing series of data pulls in scheduled scripts when one or more DB servers are down</title>
      <link>https://community.jmp.com/t5/Discussions/Executing-series-of-data-pulls-in-scheduled-scripts-when-one-or/m-p/430591#M68034</link>
      <description>&lt;P&gt;All,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a script that pulls various databases around the world. This script is scheduled and automated. Meaning that it does what it does, saves all the tables, closes JMP and task is then finished.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, from time to time one or two DBs are unresponsive. LDAP server is down and doesn't accept my password, or some DB maintenance etc.&lt;/P&gt;&lt;P&gt;In this case I get a pop-up window like that:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="Screenshot 2021-10-26 153937.png" style="width: 344px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/37036iACDAB69A4568F29F/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2021-10-26 153937.png" alt="Screenshot 2021-10-26 153937.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Even if I'm there when this happens and click "Cancel", the script exits without completing.&lt;/P&gt;&lt;P&gt;I have the function that pulls the data from DB encapsulated in try\catch block - doesn't seem to help when I manually click the "Cancel" button... But more importantly - how do I run script unsupervised in this case? How do I tell it - if you can't connect to one of the DBs - let it go, pull data from the rest of the DBs and process what you have... Don't hang up the whole script only because one of the DBs is unresponsive... How do I get rid of that pop up window and just consider it failed try, move to catch block and go on with the script?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's portion of the script that is responsible for this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;DBPaths = [
	"Server1" =&amp;gt; "ODBC:DSN=...PORT=5432;",
	"Server2" =&amp;gt; "ODBC:DSN=...PORT=5432;",
	"Server3" =&amp;gt; "ODBC:DSN=...PORT=5432;",
	"Server4" =&amp;gt; "ODBC:DSN=...PORT=5432;",
	"Server5" =&amp;gt; "ODBC:DSN=...PORT=5432;"];


myQuery = Function( {serverDBPath, server}, 

	New SQL Query(
		Version( 130 ),
		Connection( serverDBPath ),
		QueryName( server ),
		Select( ... ),
		From( ... ),
		Where( ... ),
		PostQueryScript( ... )
	) &amp;lt;&amp;lt; Run Foreground()
);

myDTs = {};

For Each( {{server, DBPath}, index}, DBPaths,
	Show( server, DBPath, index );
	Try( myDTs[index] = myQuery( DBPath, server ), writeToLog( server || " Query error... Using: " || DBPath ||" Error message: "||exception_msg[1] ) );
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Thanks,&amp;nbsp;&lt;/P&gt;&lt;P&gt;M.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 10 Jun 2023 20:47:26 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Executing-series-of-data-pulls-in-scheduled-scripts-when-one-or/m-p/430591#M68034</guid>
      <dc:creator>miguello</dc:creator>
      <dc:date>2023-06-10T20:47:26Z</dc:date>
    </item>
    <item>
      <title>Re: Executing series of data pulls in scheduled scripts when one or more DB servers are down</title>
      <link>https://community.jmp.com/t5/Discussions/Executing-series-of-data-pulls-in-scheduled-scripts-when-one-or/m-p/431053#M68082</link>
      <description>&lt;P&gt;I wonder if running the queries in the background would help?&amp;nbsp; I often use a method like the one below with a check that the returned data is valid:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;LI-MESSAGE title="Run queries in background, wait for them to complete, and reference them in the remaining JSL script" uid="274591" url="https://community.jmp.com/t5/JMP-Scripts/Run-queries-in-background-wait-for-them-to-complete-and/m-p/274591#U274591" discussion_style_icon_css="lia-mention-container-editor-message lia-img-icon-tkb-thread lia-fa-icon lia-fa-tkb lia-fa-thread lia-fa"&gt;&lt;/LI-MESSAGE&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Oct 2021 13:43:59 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Executing-series-of-data-pulls-in-scheduled-scripts-when-one-or/m-p/431053#M68082</guid>
      <dc:creator>ih</dc:creator>
      <dc:date>2021-10-28T13:43:59Z</dc:date>
    </item>
  </channel>
</rss>

