Rlabkey - HTTP error code 500 using executeSql function

LabKey Support Forum (Inactive)
Rlabkey - HTTP error code 500 using executeSql function jpellet  2024-01-16 03:21
Status: Active
 

Dear Molly,

thank you for your reply.

Yes I use an API key to authenticate but the Syntax error 'U0VMRUNUJTIwKiUyMGZyb20lMjBUZXN...' does not match my API key.
I tested the same code with an other user account (so an other API key) and the message is exactly the same, with the same Syntax error.

I also tried to authenticate using labkey.setDefaults in RStudio with email and password, and I got the same error message.

I dropped the line setting colNameOpt from the executeSql, same Error message. I put colNameOpt to the selectRows and I got the correct result:

    baseUrl="http://localhost:8080/labkey",
    folderPath="/DEMO",
    schemaName="lists",
    queryName="Test",
    colNameOpt = "rname") 
 patient_id gender Date
1       1022   Male      2016-08-08
2       1030   Male      2016-11-25 ```

If I change the sql query to only select Gender using executeSql I get the same error message:

```test<-labkey.executeSql(
    baseUrl="http://localhost:8080/labkey", 
    folderPath = "/DEMO",
    schemaName = "lists",
    sql="SELECT gender from Test")
Error in handleError(response, haltOnError) : 
 HTTP request was unsuccessful. Status code = 500, Error message = Error on line 1: Syntax error near 'U0VMRUNUJTIwZ2VuZGVyJTIwZ....'

If I make a deliberate mistake on the sql query I get the same error.

Labkey version 22.11.0
Tomcat 9.0.83
Postgresql 13.13
Java 17.0.9