Merge SQL Statement (that imports Data from a json)

database
studio
sql

#1

Hi Guys i use an SQL Statement to Import data from an json file to the database.
Now i want to automate that. I read the How To to query a SQL database.
I added the DB connect activity to my sequence and connect it to the db (works).
Then i added the execute query activity to the stream and added the db connect Parameters. Then i added the SQL Statement.
Now i got following error:

An error has occured

Message: Cannot create and populate list type System.Data.SqlClient.SqlErrorCollection. Path ‘$values’, line 1, position 163.

Source: Newtonsoft.Json

Exception Type: JsonSerializationException

Newtonsoft.Json.JsonSerializationException: Cannot create and populate list type System.Data.SqlClient.SqlErrorCollection. Path ‘$values’, line 1, position 163.
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateNewList(JsonReader reader, JsonArrayContract contract, Boolean& createdFromNonDefaultCreator)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateList(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, Object existingValue, String id)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.ReadMetadataProperties(JsonReader reader, Type& objectType, JsonContract& contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue, Object& newValue, String& id)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateISerializableItem(JToken token, Type type, JsonISerializableContract contract, JsonProperty member)
at Newtonsoft.Json.Serialization.JsonFormatterConverter.Convert(Object value, Type type)
at System.Runtime.Serialization.SerializationInfo.GetValue(String name, Type type)
at System.Data.SqlClient.SqlException…ctor(SerializationInfo si, StreamingContext sc)
at Void .ctor(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)(Object )
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateISerializable(JsonReader reader, JsonISerializableContract contract, JsonProperty member, String id)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings)
at UiPath.Shared.JsonParser.DeserializeObject[T](String jsonValue)
at UiPath.Models.UiPathDuplexProxy.<>c__DisplayClass21_0.b__0()
at System.Threading.Tasks.Task.InnerInvoke()
at System.Threading.Tasks.Task.Execute()

Any Hints?

Regards Timo


#2

I am also facing same problem. Can some one please help us


#3

Can we have more details? Studio version, UiPath.Database.Activities pack version, have you done the same steps as the initial post and anything that you think it will help us reproduce.

Thanks!


#4

Following are the details :

Studio : 2018.1.0
activity : UiPath.Database.Activities.DatabaseConnect
(I am not sure about how to check the activity pack version)

Connection string : “Data Source=localhost;Initial Catalog=db;User ID=root;Password=root”
Provider name : “System.Data.SqlClient”

I have just started using Database using UIPATH and I was trying to connect using DatabaseConnect activity and i faced this issue.


#5

I am facing same kind of error when i am trying to write data into database using " insert activity".

any one had any solution ?
Thanks.


#6

Does anyone have a solution for this yet? Cz am also facing the same issue!


#7

Hi Ovi,

I’m also facing the same issue. Do you have any solution for this?


#8

In the ExecuteQuery workflow try change the Timeout(milliseconds) property to something high. I think we get that error if SQL query is not done pulling data within the default timeout of 30 seconds.
By changing the timeout property I got rid of the error. It may work for some of you guys too.