Trouble with JSON (string) conversion as IN Param to MySQL SPROC


#1

Hello,
I am using POSTMAN to send requests to MySQL stored procedures. The ones with simple input parameters work fine, but inputting a JSON array is giving me trouble. I’m running DF 2.1 on a Bitnami instance on AWS. My call looks like …/api/v2/vendb3/_proc/sampleproc . I’m running under an admin role. I am receiving the following error:
“Failed to call database stored procedure.\nArray to string conversion”

The DF and Apache logs do not shed any light on the root cause of this error.

The body of my request (running RAW as Content-Type=application/json) looks like the following:
{
“params”: [
{
“name”: “PList_of_Persons”,
“param_type”: “IN”,
“type”: “String”,
“value”: [
{“PersonsID”: 38},
{“PersonsID”: 37}
]
},
{
“name”: “PSQLResult”,
“param_type”: “OUT”,
“type”: “String”
}
]
}

The problem appears related to the value of the PList_of_Persons input array, which I cast to JSON within the called SPROC. Unfortunately, I never get to the SPROC, which executes correctly when executed within the MySQL Workbench by the way. Can anyone help me with the syntax for inputting a JSON parameter value here? I have tried various ways of quoting the “string” value, without success. Thanks in advance for your help.


#2

Hi @darrelv, I am having the same issue. Did you ever get it resolved?

Thanks!


#3

I had been struggling to work around the problem described in this posting, and an intermittent error with the message “Unknown type 245 sent by the server. Please send a report to the developers”. After checking other blogs, I noticed a few conversations about a supposed bug (link) in PHP 5.6.7, when integrated to a MySQL 5.7.8 instance and doing JSON string conversions. Recently, DF 2.1.1 was released with PHP 5.6.19 (link). I read that the PHP bug had been resolved in 5.6.19, so I decided to try an upgrade to DF 2.1.1 to get it. We had been using DF 2.1.0. After the upgrade, most of my problems with JSON data conversion between my SPROC’s and DF disappeared. I cannot be sure that the PHP bug fix was the root of the original problem, but I’ve not had the same problems since the upgrade.


#4

Thanks for the info, I’ll have to go verify my config.