cancel
Showing results for 
Search instead for 
Did you mean: 

Data Gateway Add Connection API

Saravanan
Contributor III

I am trying to connect with a database inside Archer DB server using Archer OOB Flexible SQL Data Gateway Connector.  I am able to generate the session token, but getting error with Add Connection API. 

 

We are using Archer 6.7.00000.1184.  The same connection string is working through a data feed.  Kindly help me to resolve the issue.

 

Below is my JSON request and the error i am getting

 

API URL: http://xxx.xx.xx/RSAArcher/platformapi/DataGateway/Connections

JSON Request:

{
"TargetId": 374,
"Connection": {
"LocationAlias": "Test_DG1",
"DatagatewayConnector": {
"ConnectorType": "ArcherTech.Datasource.Content.GenericSql.GenericSqlDataSource",
"Properties": [
{
"Name": "dbProviderType",
"Value": "System.Data.SqlClient"
},
{
"Name": "connectionString",
"Value": "Data Source=ARCHER6-6\MSSQLXX;Initial Catalog=Test_DB_DataG;User ID=User12;Password=XXX;TransparentNetworkIPResolution=False"
},
{
"Name": "tableName",
"Value": "dbo.Table_1"
},
{
"Name": "idColumnName",
"Value": "Field_Id"
},
{
"Name": "idColumnType",
"Value": "smallint"
}
]
}
}
}

 

Error Response:

{"Message":"An error has occurred.","ExceptionMessage":"Object reference not set to an instance of an object.
","ExceptionType":"System.NullReferenceException","StackTrace":"
at ArcherApi.Controllers.ModuleDataGatewayController.Post(DataGateway moduleDataGateway)\r\n
at lambda_method(Closure , Object , Object[] )\r\n
at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass6_1.<GetExecutor>b__3(Object instance, Object[] methodParameters)\r\n
at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken)\r\n---
End of stack trace from previous location where exception was thrown ---\r\n
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n
at System.Web.Http.Controllers.ApiControllerActionInvoker.<InvokeActionAsyncCore>d__1.MoveNext()\r\n---
End of stack trace from previous location where exception was thrown ---\r\n
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n
at System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__5.MoveNext()\r\n---
End of stack trace from previous location where exception was thrown ---\r\n
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n
at System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__15.MoveNext()"}

22 REPLIES 22

DavidFreeman
Archer Employee
Archer Employee

Howdy,

 

Did you try /b?

 

https://www.freeformatter.com/json-escape.html

 

David

I guess, \b is for backspace.  For Backslah, its \\.  If i use \\, i am getting the below error on running search

 

<E2ETraceEvent xmlns="http://schemas.microsoft.com/2004/06/E2ETraceEvent">
<System xmlns="http://schemas.microsoft.com/2004/06/windows/eventlog/system">
<EventID>5</EventID>
<Type>3</Type>
<SubType Name="Error">0</SubType>
<Level>2</Level>
<TimeCreated SystemTime="2020-08-05T07:04:20.1848410Z" />
<Source Name="Archer.NET" />
<Correlation ActivityID="{00000000-0000-0000-0000-000000000000}" />
<Execution ProcessName="w3wp" ProcessID="14080" ThreadID="20" />
<AssemblyVersion>6.7.0.1184</AssemblyVersion>
<Channel />
<Computer>ARCHERX</Computer>
</System>
<ApplicationData>
<TraceData>
<DataItem>
<TraceRecord Severity="Error" xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord">
<TraceIdentifier>Archer.NET</TraceIdentifier>
<UserId>206</UserId>
<Description>No datasource registered for the location: Test_DG1</Description>
<AppDomain>/LM/W3SVC/1/ROOT/RSAarcher-1-132410844792294787</AppDomain>
<Exception>
<ExceptionType>System.Exception, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType>
<Message>No datasource registered for the location: Test_DG1</Message>
<Source>ArcherTech.Datasource.Content</Source>
<StackTrace> at ArcherTech.Datasource.Content.ContentDatasourceFactory.Create(SessionContext session, ContentPartLocation location)
at ArcherTech.Kernel.Brokers.Search.ContentSearchFilterCreator.Create(SessionContext sessionContext, DatasourceSearchFilterType filterType, ContentPartLocation location)
at ArcherTech.Kernel.Brokers.SearchFilteringBroker.ApplyFilterCriteria(ParseNode node)
at ArcherTech.Kernel.Brokers.SearchFilteringBroker.ProcessFilters(IList`1 nodes, Int32 currLevelId, Nullable`1 logicOperator)
at ArcherTech.Kernel.Brokers.SearchFilteringBroker.ExecuteCriteriaFilters(Int32 levelId)
at ArcherTech.Kernel.Brokers.SearchBuildoutBrokerBase.GetFilteredContent(SearchModuleCriteria moduleCriteria, Int32 levelId)
at ArcherTech.Kernel.Brokers.SearchBuildoutBrokerBase.BuildLevel(SearchModuleCriteria searchModuleCriteria, Int32 levelId, Boolean includeAll)
at ArcherTech.Kernel.Brokers.SearchBuildoutBroker.BuildSingleLevel(SearchModuleCriteria searchModuleCriteria, IDictionary`2 permissions)
at ArcherTech.Kernel.Brokers.SearchBuildoutBroker.Buildout()
at ArcherTech.Kernel.Brokers.SearchEngineBroker.ExecuteSearchBuildout(SearchCriteria criteria, String timeZone, IDictionary`2&amp; searchModules, SearchBuildout&amp; searchBuildout, SearchRequestSource searchRequestSource)
at ArcherTech.Kernel.Brokers.SearchEngineBroker.ExecuteSearch(SearchCriteria criteria, String timeZone, SearchRequestSource searchRequestSource)
at ArcherTech.Kernel.Managers.SearchEngineManager.ExecuteSearch(SessionContext sessionContext, SearchCriteria criteria, String timeZone, SearchRequestSource searchRequestSource)</StackTrace>
</Exception>
</TraceRecord>
</DataItem>
</TraceData>
</ApplicationData>
</E2ETraceEvent>

DavidFreeman
Archer Employee
Archer Employee

Sorry about that.

 

Can you point to the IP address?

 

I dunno if this will work, but from the server running the script, can you update the hosts file to point to the db?  That is:

 

databasename\\withslashes ThisIsShorter

 

Or

 

databaseIPaddress ThisIsShorter

Yeah, tried that too.. IP address login is not working even for direct sql server connect or from datafeed.  I verified the GetConnection Api result and confirmed the data source is having only one \, i.e "Data Source=ARCHER6-6\MSSQLXX;Initial Catalog=Test_DB_DataG;User ID=User12;Password=XXX;TransparentNetworkIPResolution=False".  Even by having correct data source, its throwing above error.

 

Hi Rajaram,

            just to check if its a single node you can remove the \MSSQLXX (i.e.  Data Source=ARCHER6-6 ) 

and try to login and if it works in SQL client do the same in connection string also.

 "Data Source=ARCHER6-6;Initial Catalog=Test_DB_DataG;User ID=User12;Password=XXX;TransparentNetworkIPResolution=False"

 

 "Data Source=ARCHER6-6\MSSQLXX;Initial Catalog=Test_DB_DataG;User ID=User12;Password=XXX;TransparentNetworkIPResolution=False"

Nope its having multiple instance.  I will need to make this instance as the default instance to try this.

Did you do an IIS reset after the API ran successfully? That is required pre-6.8. 

Yes,  Caylor.. Done IIS Reset after api successfull ran.

Are you able to log in and access your data with your SQL user to SSMS? 

Yes, even i am able to connect sql by data feed using the same data source.