AG

Hi!

Is there a way to connect a Microsoft SQL Server and get a query result from Aris script? We need to synchronize data between external data source which exists on another SQL Server with objects attributes in Aris database.

On current moment we transfer those data into an Excel book and import them into objects attributes with Aris script from that book. It is a long way.

Regards,

by Ariene Kroeze
Posted on Thu, 04/13/2017 - 15:35

some years ago I created a small script to establish a connection to a SQL server. Maybe it still works:

 function ABC() {
    Dialogs.MsgBox('test');
};
 
function class_for_name(name) {
    return new Function('return new ' + name)();
}
 
var a = class_for_name('ABC');

function main() {

      // Create a variable for the connection string.
      var connectionUrl = "jdbc:sqlserver://localhost:1433;" +
         "databaseName=AdventureWorks;user=UserName;password=*****";

      // Declare the JDBC objects.
      var con = null;
      var stmt = null;
      var rs = null;

      try {
         // Establish the connection.
         class_for_name("com.microsoft.sqlserver.jdbc.SQLServerDriver");
         con = new java.sql.DriverManager.getConnection(connectionUrl);

         // Create and execute an SQL statement that returns some data.
         var SQL = "SELECT TOP 10 * FROM Person.Contact";
         stmt = con.createStatement();
         rs = stmt.executeQuery(SQL);

         // Iterate through the data in the result set and display it.
         while (rs.next()) {
            Dialogs.MsgBox(rs.getString(4) + " " + rs.getString(6));
         }
      }

      // Handle any errors that may have occurred.
      catch (ex) {
         var lex=ex;;
         var aa=0;
      }
      finally {
         if (rs != null) try { rs.close(); } catch(ex) {}
         if (stmt != null) try { stmt.close(); } catch(ex) {}
         if (con != null) try { con.close(); } catch(ex) {}
      }
   
}
main()

greetings, Ariene Kroeze

0

Featured achievement

Rookie
Say hello to the ARIS Community! Personalize your community experience by following forums or tags, liking a post or uploading a profile picture.
Recent Unlocks

Leaderboard

|
icon-arrow-down icon-arrow-cerulean-left icon-arrow-cerulean-right icon-arrow-down icon-arrow-left icon-arrow-right icon-arrow icon-back icon-close icon-comments icon-correct-answer icon-tick icon-download icon-facebook icon-flag icon-google-plus icon-hamburger icon-in icon-info icon-instagram icon-login-true icon-login icon-mail-notification icon-mail icon-mortarboard icon-newsletter icon-notification icon-pinterest icon-plus icon-rss icon-search icon-share icon-shield icon-snapchat icon-star icon-tutorials icon-twitter icon-universities icon-videos icon-views icon-whatsapp icon-xing icon-youtube icon-jobs icon-heart icon-heart2 aris-express bpm-glossary help-intro help-design Process_Mining_Icon help-publishing help-administration help-dashboarding help-archive help-risk icon-knowledge icon-question icon-events icon-message icon-more icon-pencil forum-icon icon-lock