Smart Integration Cloud (SIC) gateway to update / delete / truncate / insert into local tables
Hello,
I'm having a lot of difficulties in trying to connect to my local gateway to execute a business rule that would insert values from a datatable into a local sql table. The examples providing in the documentation look incomplete or contain errors.
- My gateway is called : abc_gateway and redirect to my local machine which is online
- I have a custom database server connection which is redirected towards my local machine 'abc_local'
My business rule that will invoke the BR on my local machine (this business rule currently sits in a workspace assembly) :
Dim GatewayName As String = "abc_gateway" ' Name of the Gateway
Dim SICFunctionName As String = "SIC_Functions" ' Name of the SIC Function to run
Dim RemoteMethodName As String = "RunOperation" ' Name of the method inside the SIC Function that will be called.
Dim resultdatatable = BRApi.Utilities.ExecRemoteGatewayBusinessRule(si, SICFunctionName, Nothing, GatewayName, RemoteMethodName)
Then I have a smart integration function in business rule :
Imports System
Imports System.Collections.Generic
Imports System.Data
Imports System.Data.Common
Imports System.Globalization
Imports System.IO
Imports System.Linq
Imports System.Data.SqlClient
Imports OneStreamGatewayService
Namespace OneStream.BusinessRule.SmartIntegrationFunction.SIC_Functions
Public Class MainClass
Public Function RunOperation() As DataTable
Dim datatableresults = New DataTable()
Dim connectionString As String = APILibrary.GetRemoteDataSourceConnection("MyTests") '<-- my local sql database
Using Connection = New SqlConnection(connectionString)
connection.open()
Dim sql As String = "select * from test" '<-- query to the test sql table of my local sql datatabase
Dim cmd As SqlCommand = New SqlCommand(sql, connection)
Dim dbreader = cmd.ExecuteReader()
dataTableResults.Load(dbreader)
Return dataTableResults
End Using
End Function
End Class
End Namespace
This is my local SQL database and my local sql table. I can indeed connect to it in a data adapter but can't seem to execute a remote business rule :
I just constantly keep the message : "The ConnectionString property has not been initialized." I tried changing the APILibrary.GetRemoteDataSourceConnection to either the custom database connexion name, the gateway name ... but can't work this out.
Regards,