Skip to content

Add Java and driver versions to SQL error report - #344

Open
DG47 wants to merge 1 commit into
OHDSI:developfrom
DG47:fix/error-report-java-version
Open

DG47 wants to merge 1 commit into
OHDSI:developfrom
DG47:fix/error-report-java-version

Conversation

@DG47

@DG47 DG47 commented Oct 13, 2026

Copy link
Copy Markdown

Fixes #267

The SQL error report (errorReportSql.txt) now includes the Java version and, as suggested in the issue comments, the driver version:

  • Java version, from java.lang.System.getProperty("java.version").
  • For JDBC connections: the JDBC driver name and version from DatabaseMetaData (for example PostgreSQL JDBC Driver (42.7.3)).
  • For DBI connections (DuckDB, SQLite, or a plain DBI connection passed to querySql() / executeSql()): the DBI driver package and its version (for example duckdb (1.5.6)).

These lines appear after Platform: in the system info section. Each lookup is wrapped in tryCatch() and falls back to Unknown, so the report is still written when the connection is broken.

.createErrorReport() has a new optional connection argument, and all five call sites (executeSql() twice, querySql(), renderTranslateQueryApplyBatched(), and querySqlToAndromeda()) pass the connection. Nothing else changes, and NEWS.md is not touched.

Example report section (Postgres):

Platform:
aarch64-apple-darwin27.0.0

Java version:
17.0.20.1

JDBC driver:
PostgreSQL JDBC Driver (42.7.3)

Attached base packages:
...

Tests: the new tests/testthat/test-errorReport.R loops over the test servers and checks the report for both JDBC connections (Postgres) and DBI connections (SQLite, DuckDB). It also has one test with a plain duckdb DBI connection. I ran it against PostgreSQL 16 in Docker plus the local SQLite and DuckDB servers. It fails on develop and passes with this change. R CMD check --no-manual --ignore-vignettes gives Status: OK.

The error report now lists the Java version, and the JDBC driver name
and version for JDBC connections (or the DBI driver package and version
for DBI connections). Fixes OHDSI#267

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant