Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce support for InterSystems IRIS #2416

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
18 changes: 16 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

<circe.version>1.11.2</circe.version>
<jersey.version>2.14</jersey.version>
<SqlRender.version>1.16.1</SqlRender.version>
<SqlRender.version>1.19.1</SqlRender.version>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noting that SqlRender v1.19.0 release notes mentioned that IRIS support is 'tentative'. By extension, we'll view IRIS support as 'tentative' in WebAPI & ATLAS.

<hive-jdbc.version>3.1.2</hive-jdbc.version>
<pac4j.version>4.0.0</pac4j.version>
<jackson.version>2.12.7</jackson.version>
Expand Down Expand Up @@ -200,7 +200,7 @@
<server.ssl.key-password></server.ssl.key-password>
<server.servlet.context-path>/WebAPI</server.servlet.context-path>

<arachne.version>1.17.3</arachne.version>
<arachne.version>1.17.4</arachne.version>
<jersey-media-multipart.version>2.25.1</jersey-media-multipart.version>
<execution.invalidation.period>600000</execution.invalidation.period>
<execution.invalidation.maxage.hours>12</execution.invalidation.maxage.hours>
Expand Down Expand Up @@ -1859,6 +1859,20 @@
</dependency>
</dependencies>
</profile>
<profile>
<id>webapi-iris</id>
<properties>
<iris.enabled>true</iris.enabled>
<iris.driver.version>3.10.2</iris.driver.version>
</properties>
<dependencies>
<dependency>
<groupId>com.intersystems</groupId>
<artifactId>intersystems-jdbc</artifactId>
<version>${iris.driver.version}</version>
</dependency>
</dependencies>
</profile>
<profile>
<id>webapi-gis</id>
<properties>
Expand Down
46 changes: 46 additions & 0 deletions src/main/extras/iris/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Using WebAPI with InterSystems IRIS support

## Building WebAPI

To build WebAPI with InterSystems IRIS support, you can simply use the `webapi-iris` profile
when building WebAPI with Maven:

```Shell
mvn -Pwebapi-postgresql,webapi-iris clean package
```

or on Windows PowerShell:
```Shell
mvn "-Pwebapi-postgresql,webapi-iris" clean package
```

This will automatically download and package a recent version of the InterSystems IRIS JDBC
driver from Maven Central.

Alternatively, the JDBC driver for InterSystems IRIS can be found in the `dev/java/lib/1.8/`
subfolder of your IRIS installation, or as a download from InterSystems Cloud Services portal.


## Sample configuration

When configuring Atlas / WebAPI to access CDM on IRIS over a secure connection, your source
registration looks like this:
```SQL
INSERT INTO webapi.source (source_id, source_name, source_key, source_connection, source_dialect, username, password)
VALUES (<#>, 'OHDSI IRIS Database', 'IRIS', 'jdbc:IRIS://<hostname>.elb.us-west-2.amazonaws.com:443/USER/:::true',
'iris', '<username>','<password>');
```

For a non-encrypted, local connection, this may look like:
```SQL
INSERT INTO webapi.source (source_id, source_name, source_key, source_connection, source_dialect, username, password)
VALUES (<#>, 'OHDSI IRIS Database', 'IRIS', 'jdbc:IRIS://localhost:1972/USER/', 'iris', '_SYSTEM_','SYS');
```


## References

For more information on how to connect to InterSystems IRIS or InterSystems IRIS Cloud SQL, please see:
* [Connecting your applications to Cloud SQL](https://docs.intersystems.com/components/csp/docbook/DocBook.UI.Page.cls?KEY=GDRIVE_cloudsql)
* [Troubleshooting connection issues](https://docs.intersystems.com/services/csp/docbook/DocBook.UI.Page.cls?KEY=ACTS)
* [InterSystems fork for OHDSI Broadsea](https://github.com/isc-krakshith/InterSystems-Broadsea/)
2 changes: 1 addition & 1 deletion src/main/java/org/ohdsi/webapi/DataAccessConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public DataSource primaryDataSource() {
//note autocommit defaults vary across vendors. use provided @Autowired TransactionTemplate

String[] supportedDrivers;
supportedDrivers = new String[]{"org.postgresql.Driver", "com.microsoft.sqlserver.jdbc.SQLServerDriver", "oracle.jdbc.driver.OracleDriver", "com.amazon.redshift.jdbc.Driver", "com.cloudera.impala.jdbc.Driver", "net.starschema.clouddb.jdbc.BQDriver", "org.netezza.Driver", "com.simba.googlebigquery.jdbc42.Driver", "org.apache.hive.jdbc.HiveDriver", "com.simba.spark.jdbc.Driver", "net.snowflake.client.jdbc.SnowflakeDriver", "com.databricks.client.jdbc.Driver"};
supportedDrivers = new String[]{"org.postgresql.Driver", "com.microsoft.sqlserver.jdbc.SQLServerDriver", "oracle.jdbc.driver.OracleDriver", "com.amazon.redshift.jdbc.Driver", "com.cloudera.impala.jdbc.Driver", "net.starschema.clouddb.jdbc.BQDriver", "org.netezza.Driver", "com.simba.googlebigquery.jdbc42.Driver", "org.apache.hive.jdbc.HiveDriver", "com.simba.spark.jdbc.Driver", "net.snowflake.client.jdbc.SnowflakeDriver", "com.databricks.client.jdbc.Driver", "com.intersystems.jdbc.IRISDriver"};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you describe how you would download the IRIS JDBC driver? A quick Google search brought me to this page: https://intersystems-community.github.io/iris-driver-distribution/. It would be useful to document this in the pull request and other OHDSI documentation.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is described in our forthcoming DatabaseConnector submission (and taken care of in the downloadJdbcDrivers() function, but indeed that isn't obvious from here right now. Is there any place you recommend we can document this?
Also, since preparing this PR, we've started publishing our JDBC driver on Maven and I'll amend this PR with a webapi-iris Maven profile that pulls it right from there.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bdeboe - a maven profile would be ideal. To document how to use it you can follow the example for some of the other db platforms such as: https://github.com/OHDSI/WebAPI/tree/master/src/main/extras/bigquery.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. (see last two commits on this branch)

Please let me know if there's anything else you'd like us to add before this PR is eligible to be merged

for (String driverName : supportedDrivers) {
try {
Class.forName(driverName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,8 @@ private boolean supportsBatchUpdates(Connection connection) throws SQLException

// NOTE:
// com.cloudera.impala.hivecommon.dataengine.HiveJDBCDataEngine.prepareBatch throws NOT_IMPLEMENTED exception
return JdbcUtils.supportsBatchUpdates(connection) && !connection.getMetaData().getURL().startsWith("jdbc:impala");
return JdbcUtils.supportsBatchUpdates(connection)
&& !connection.getMetaData().getURL().startsWith("jdbc:impala")
&& !connection.getMetaData().getURL().startsWith("jdbc:IRIS");
}
}
3 changes: 2 additions & 1 deletion src/main/resources/i18n/messages_en.json
Original file line number Diff line number Diff line change
Expand Up @@ -2601,7 +2601,8 @@
"sqlserver": "SQL server",
"synapse": "Azure Synapse",
"snowflake": "Snowflake",
"spark": "Apache Spark"
"spark": "Apache Spark",
"iris": "InterSystems IRIS"
},
"title": "Source dialect"
},
Expand Down
3 changes: 2 additions & 1 deletion src/main/resources/i18n/messages_ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -2600,7 +2600,8 @@
"sqlserver": "SQL server",
"synapse": "Azure Synapse",
"snowflake": "Snowflake",
"spark": "Apache Spark"
"spark": "Apache Spark",
"iris": "InterSystems IRIS"
},
"title": "소스 dialect"
},
Expand Down
3 changes: 2 additions & 1 deletion src/main/resources/i18n/messages_ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -2514,7 +2514,8 @@
"hive": "Hive LLAP",
"synapse": "Azure Synapse",
"snowflake": "Snowflake",
"spark": "Apache Spark"
"spark": "Apache Spark",
"iris": "InterSystems IRIS"
}
},
"connectionString": {
Expand Down
3 changes: 2 additions & 1 deletion src/main/resources/i18n/messages_zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -2600,7 +2600,8 @@
"sqlserver": "SQL服务器",
"synapse": "Azure Synapse",
"snowflake": "Snowflake",
"spark": "Apache Spark"
"spark": "Apache Spark",
"iris": "InterSystems IRIS"
},
"title": "源语言"
},
Expand Down
14 changes: 14 additions & 0 deletions src/test/java/org/ohdsi/webapi/util/DataSourceDTOParserTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public class DataSourceDTOParserTest {
public static final String ORACLE_WO_PWD_CONN_STR = "jdbc:oracle:thin:@myhost:1521:orcl";
public static final String ORACLE_WITH_PWD_CONN_STR = "jdbc:oracle:thin:scott/tiger@myhost:1521:orcl";
public static final String HIVE_CONN_STR = "jdbc:hive2://sandbox-hdp.hortonworks.com:2181/synpuf_531_orc;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2";
public static final String IRIS_CONN_STR = "jdbc:IRIS://localhost:1972/USER";

@Test
public void parseDTO() {
Expand Down Expand Up @@ -110,6 +111,12 @@ public void parseDTO() {
assertThat(dto.getConnectionString(), is(HIVE_CONN_STR));
assertThat(dto.getUsername(), is(nullValue()));
assertThat(dto.getPassword(), is(nullValue()));

dto = DataSourceDTOParser.parseDTO(getIRISSource());
assertThat(dto.getType(), is(DBMSType.IRIS));
assertThat(dto.getConnectionString(), is(IRIS_CONN_STR));
assertThat(dto.getUsername(), is(nullValue()));
assertThat(dto.getPassword(), is(nullValue()));
}

private Source getPostgreSQLPasswordSource() {
Expand Down Expand Up @@ -204,4 +211,11 @@ private Source getHiveSource() {
source.setSourceConnection(HIVE_CONN_STR);
return source;
}

private Source getIRISSource() {
Source source = new Source();
source.setSourceDialect("iris");
source.setSourceConnection(IRIS_CONN_STR);
return source;
}
}