OHDSI / OHDSI/DatabaseConnector
Error when creating cohort tables using `executeSql()` on Microsoft SQL Server
Nobody has claimed this yet.
- Dominant language
- R
- Stars
- 57
- Forks
- 93
- Avg merge
- 10d 12h
- Merged PRs (30d)
- 1
Description
Hi,
I'm trying to run the Strategus package with Microsoft SQL Server, but I'm getting the following error when running the CohortGenerator module:
Error executing SQL:
com.microsoft.sqlserver.jdbc.SQLServerException: A result set was generated for update.
I found that this error occurs when createCohortTables() from the CohortGenerator package executes executeSql().
It seems that when a CREATE TABLE statement is executed, SQL Server returns a result set, which causes this error in R/JDBC.
I temporarily fixed this issue by using querySql() instead of executeSql() when executing a CREATE TABLE statement.
Is there any known workaround, or does anyone know why this happens?
Environment:
R version: 4.4.3 (2025-02-28 ucrt)
Platform: x86_64-w64-mingw32/x64
OS: Windows Server 2022 x64 (build 20348)
CohortGenerator version: 1.1.0
DatabaseConnector version: 7.1.0
Java version: 17.0.13
DBMS: Microsoft SQL Server
Thanks.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the error in createCohortTables() from the CohortGenerator package with Microsoft SQL Server, then trace its executeSql() call and compare it with the reported querySql() workaround. Done means cohort tables can be created successfully through the supported path without the SQLServerException; the issue does not name a source file or test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- r, sql
- Domain
- database
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 50/100