Skip to content

Commit

Permalink
Add support for Intersystems IRIS jdbc driver (#7607)
Browse files Browse the repository at this point in the history
* Support Intersystems IRIS jdbc driver

* use .lenght
  • Loading branch information
amarziali authored Sep 12, 2024
1 parent 2cbbb43 commit 5dc6a14
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -781,6 +781,20 @@ DBInfo.Builder doParse(String jdbcUrl, DBInfo.Builder builder) {
}
return GENERIC_URL_LIKE.doParse(url, builder);
}
},

IRIS("iris") {
@Override
DBInfo.Builder doParse(String jdbcUrl, DBInfo.Builder builder) {
String url = jdbcUrl;
int firstSlash = url.indexOf('/', "jdbc://iris:/".length());
int nextSlash = url.indexOf('/', firstSlash + 1);
if (nextSlash > firstSlash) {
// strip the options and preserve only the url like part
url = url.substring(0, nextSlash);
}
return GENERIC_URL_LIKE.doParse(url, builder);
}
};

private static final Map<String, JDBCConnectionUrlParser> typeParsers = new HashMap<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ public class DefaultConnectionInstrumentation extends AbstractConnectionInstrume
"com.sap.db.jdbc.ConnectionSapDB",
// IBM Informix
"com.informix.jdbc.IfmxConnection",
// Intersystems IRIS
"com.intersystems.jdbc.IRISConnection",
// for testing purposes
"test.TestConnection"
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ public final class PreparedStatementInstrumentation extends AbstractPreparedStat
"software.aws.rds.jdbc.mysql.shading.com.mysql.cj.JdbcCallableStatement",
// IBM Informix
"com.informix.jdbc.IfxPreparedStatement",
// Intersystems IRIS
"com.intersystems.jdbc.IRISPreparedStatement",
"com.intersystems.jdbc.IRISCallableStatement",
// for testing purposes
"test.TestPreparedStatement"
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,10 @@ class JDBCConnectionUrlParserTest extends AgentTestRunner {

// redshift
"jdbc:redshift://redshift-cluster-1.c7arcolffyvk.us-east-2.redshift.amazonaws.com:5439/dev" | null | "redshift" | null | null | "redshift-cluster-1.c7arcolffyvk.us-east-2.redshift.amazonaws.com" | 5439 | "redshift-cluster-1" | "dev"
// Intersys IRIS
"jdbc:IRIS://dbhostname:1972/namespace" | null | "iris" | null | null | "dbhostname" | 1972 | null | "namespace"
"jdbc:IRIS://dbhostname:1972/namespace/+myjdbc.log" | null | "iris" | null | null | "dbhostname" | 1972 | null | "namespace"
"jdbc:IRIS://dbhostname:1972/namespace/::false" | null | "iris" | null | null | "dbhostname" | 1972 | null | "namespace"

expected = new DBInfo.Builder().type(type).subtype(subtype).user(user).instance(instance).db(db).host(host).port(port).build()
}
Expand Down

0 comments on commit 5dc6a14

Please sign in to comment.