Add Oracle support and fix muzzle.
This commit is contained in:
parent
6100443443
commit
ec60d679d6
|
@ -260,7 +260,10 @@ public class ReferenceCreator extends ClassVisitor {
|
|||
// * DONE field-source class (descriptor)
|
||||
// * DONE field-source visibility from this point (PRIVATE?)
|
||||
|
||||
final Type ownerType = Type.getType("L" + owner + ";");
|
||||
final Type ownerType =
|
||||
owner.startsWith("[")
|
||||
? underlyingType(Type.getType(owner))
|
||||
: Type.getType("L" + owner + ";");
|
||||
final Type fieldType = Type.getType(descriptor);
|
||||
|
||||
final List<Reference.Flag> fieldFlags = new ArrayList<>();
|
||||
|
@ -334,7 +337,10 @@ public class ReferenceCreator extends ClassVisitor {
|
|||
}
|
||||
}
|
||||
|
||||
final Type ownerType = Type.getType("L" + owner + ";");
|
||||
final Type ownerType =
|
||||
owner.startsWith("[")
|
||||
? underlyingType(Type.getType(owner))
|
||||
: Type.getType("L" + owner + ";");
|
||||
|
||||
final List<Reference.Flag> methodFlags = new ArrayList<>();
|
||||
methodFlags.add(
|
||||
|
|
|
@ -12,6 +12,8 @@ import static net.bytebuddy.matcher.ElementMatchers.takesArgument;
|
|||
import com.google.auto.service.AutoService;
|
||||
import datadog.trace.agent.tooling.Instrumenter;
|
||||
import java.sql.Connection;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import net.bytebuddy.asm.Advice;
|
||||
|
@ -33,9 +35,17 @@ public final class DriverInstrumentation extends Instrumenter.Default {
|
|||
|
||||
@Override
|
||||
public String[] helperClassNames() {
|
||||
return new String[] {
|
||||
packageName + ".JDBCConnectionUrlParser",
|
||||
};
|
||||
final JDBCConnectionUrlParser[] parsers = JDBCConnectionUrlParser.values();
|
||||
final List<String> parserClasses = new ArrayList<>(parsers.length + 3);
|
||||
|
||||
parserClasses.add(packageName + ".JDBCMaps");
|
||||
parserClasses.add(packageName + ".JDBCMaps$DBInfo");
|
||||
parserClasses.add(packageName + ".JDBCConnectionUrlParser");
|
||||
|
||||
for (final JDBCConnectionUrlParser parser : parsers) {
|
||||
parserClasses.add(parser.getClass().getName());
|
||||
}
|
||||
return parserClasses.toArray(new String[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -2,6 +2,7 @@ package datadog.trace.instrumentation.jdbc;
|
|||
|
||||
import static datadog.trace.instrumentation.jdbc.JDBCMaps.DBInfo.DEFAULT;
|
||||
|
||||
import datadog.trace.bootstrap.ExceptionLogger;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URI;
|
||||
import java.net.URLDecoder;
|
||||
|
@ -9,6 +10,8 @@ import java.util.HashMap;
|
|||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* Structured as an enum instead of a class hierarchy to allow iterating through the parsers, plus
|
||||
|
@ -22,13 +25,13 @@ public enum JDBCConnectionUrlParser {
|
|||
// Attempt generic parsing
|
||||
final URI uri = new URI(jdbcUrl);
|
||||
|
||||
String username = uri.getUserInfo();
|
||||
String user = uri.getUserInfo();
|
||||
String databaseName = null;
|
||||
if (uri.getQuery() != null) {
|
||||
final Map<String, String> queryParams = splitQuery(uri.getQuery(), "&");
|
||||
|
||||
if (username == null) {
|
||||
username = queryParams.get("user");
|
||||
if (user == null) {
|
||||
user = queryParams.get("user");
|
||||
}
|
||||
databaseName = queryParams.get("databasename");
|
||||
}
|
||||
|
@ -39,7 +42,7 @@ public enum JDBCConnectionUrlParser {
|
|||
}
|
||||
|
||||
return new JDBCMaps.DBInfo(
|
||||
uri.getScheme(), null, username, path, databaseName, uri.getHost(), uri.getPort());
|
||||
uri.getScheme(), null, user, path, databaseName, uri.getHost(), uri.getPort());
|
||||
} catch (final Exception e) {
|
||||
return DEFAULT;
|
||||
}
|
||||
|
@ -58,7 +61,7 @@ public enum JDBCConnectionUrlParser {
|
|||
Integer port = null;
|
||||
String databaseName = null;
|
||||
String instanceName = null;
|
||||
String username = null;
|
||||
String user = null;
|
||||
|
||||
final int hostIndex = jdbcUrl.indexOf("://");
|
||||
|
||||
|
@ -92,7 +95,7 @@ public enum JDBCConnectionUrlParser {
|
|||
databaseName = urlProps.get("databasename");
|
||||
}
|
||||
if (urlProps.containsKey("user")) {
|
||||
username = urlProps.get("user");
|
||||
user = urlProps.get("user");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -125,7 +128,7 @@ public enum JDBCConnectionUrlParser {
|
|||
}
|
||||
|
||||
return new JDBCMaps.DBInfo(
|
||||
type, null, username, instanceName, null /* databaseName */, serverName, port);
|
||||
type, null, user, instanceName, null /* databaseName */, serverName, port);
|
||||
} catch (final UnsupportedEncodingException e) {
|
||||
return DEFAULT;
|
||||
}
|
||||
|
@ -235,6 +238,172 @@ public enum JDBCConnectionUrlParser {
|
|||
}
|
||||
},
|
||||
|
||||
ORACLE("oracle") {
|
||||
private static final int DEFAULT_PORT = 1521;
|
||||
|
||||
@Override
|
||||
JDBCMaps.DBInfo doParse(String jdbcUrl, final Properties props) {
|
||||
final int typeEndIndex = jdbcUrl.indexOf(":", "oracle:".length());
|
||||
final String type = jdbcUrl.substring(0, typeEndIndex);
|
||||
jdbcUrl = jdbcUrl.substring(typeEndIndex + 1);
|
||||
|
||||
final JDBCMaps.DBInfo dbInfo;
|
||||
if (jdbcUrl.contains("@")) {
|
||||
dbInfo = ORACLE_AT.doParse(jdbcUrl, props);
|
||||
} else {
|
||||
dbInfo = ORACLE_CONNECT_INFO.doParse(jdbcUrl, props);
|
||||
}
|
||||
return new JDBCMaps.DBInfo(
|
||||
type,
|
||||
dbInfo.getUrl(),
|
||||
dbInfo.getUser(),
|
||||
dbInfo.getInstance(),
|
||||
dbInfo.getDb(),
|
||||
dbInfo.getHost(),
|
||||
dbInfo.getPort() == null ? DEFAULT_PORT : dbInfo.getPort());
|
||||
}
|
||||
},
|
||||
|
||||
ORACLE_CONNECT_INFO() {
|
||||
@Override
|
||||
JDBCMaps.DBInfo doParse(final String jdbcUrl, final Properties props) {
|
||||
|
||||
final String host;
|
||||
final Integer port;
|
||||
final String instance;
|
||||
|
||||
final int hostEnd = jdbcUrl.indexOf(":");
|
||||
final int instanceLoc = jdbcUrl.indexOf("/");
|
||||
if (hostEnd > 0) {
|
||||
host = jdbcUrl.substring(0, hostEnd);
|
||||
final int afterHostEnd = jdbcUrl.indexOf(":", hostEnd + 1);
|
||||
if (afterHostEnd > 0) {
|
||||
port = Integer.parseInt(jdbcUrl.substring(hostEnd + 1, afterHostEnd));
|
||||
instance = jdbcUrl.substring(afterHostEnd + 1);
|
||||
} else {
|
||||
if (instanceLoc > 0) {
|
||||
instance = jdbcUrl.substring(instanceLoc + 1);
|
||||
port = Integer.parseInt(jdbcUrl.substring(hostEnd + 1, instanceLoc));
|
||||
} else {
|
||||
final String portOrInstance = jdbcUrl.substring(hostEnd + 1);
|
||||
Integer parsedPort = null;
|
||||
try {
|
||||
parsedPort = Integer.parseInt(portOrInstance);
|
||||
} catch (final NumberFormatException e) {
|
||||
}
|
||||
if (parsedPort == null) {
|
||||
port = null;
|
||||
instance = portOrInstance;
|
||||
} else {
|
||||
port = parsedPort;
|
||||
instance = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (instanceLoc > 0) {
|
||||
host = jdbcUrl.substring(0, instanceLoc);
|
||||
port = null;
|
||||
instance = jdbcUrl.substring(instanceLoc + 1);
|
||||
} else {
|
||||
if (jdbcUrl.isEmpty()) {
|
||||
return DEFAULT;
|
||||
} else {
|
||||
host = null;
|
||||
port = null;
|
||||
instance = jdbcUrl;
|
||||
}
|
||||
}
|
||||
}
|
||||
return new JDBCMaps.DBInfo(null, null, null, instance, null, host, port);
|
||||
}
|
||||
},
|
||||
|
||||
ORACLE_AT() {
|
||||
@Override
|
||||
JDBCMaps.DBInfo doParse(final String jdbcUrl, final Properties props) {
|
||||
if (jdbcUrl.contains("@(description")) {
|
||||
return ORACLE_AT_DESCRIPTION.doParse(jdbcUrl, props);
|
||||
}
|
||||
final String user;
|
||||
|
||||
final String[] atSplit = jdbcUrl.split("@", 2);
|
||||
|
||||
final int userInfoLoc = atSplit[0].indexOf("/");
|
||||
if (userInfoLoc > 0) {
|
||||
user = atSplit[0].substring(0, userInfoLoc);
|
||||
} else {
|
||||
user = null;
|
||||
}
|
||||
|
||||
final String connectInfo = atSplit[1];
|
||||
final int hostStart;
|
||||
if (connectInfo.startsWith("//")) {
|
||||
hostStart = "//".length();
|
||||
} else if (connectInfo.startsWith("ldap://")) {
|
||||
hostStart = "ldap://".length();
|
||||
} else {
|
||||
hostStart = 0;
|
||||
}
|
||||
final JDBCMaps.DBInfo dbInfo =
|
||||
ORACLE_CONNECT_INFO.doParse(connectInfo.substring(hostStart), props);
|
||||
|
||||
return new JDBCMaps.DBInfo(
|
||||
null,
|
||||
dbInfo.getUrl(),
|
||||
user,
|
||||
dbInfo.getInstance(),
|
||||
dbInfo.getDb(),
|
||||
dbInfo.getHost(),
|
||||
dbInfo.getPort());
|
||||
}
|
||||
},
|
||||
|
||||
ORACLE_AT_DESCRIPTION() {
|
||||
private final Pattern HOST_REGEX = Pattern.compile("\\(\\s*host\\s*=\\s*([^ )]+)\\s*\\)");
|
||||
private final Pattern PORT_REGEX = Pattern.compile("\\(\\s*port\\s*=\\s*([\\d]+)\\s*\\)");
|
||||
private final Pattern INSTANCE_REGEX =
|
||||
Pattern.compile("\\(\\s*service_name\\s*=\\s*([^ )]+)\\s*\\)");
|
||||
|
||||
@Override
|
||||
JDBCMaps.DBInfo doParse(final String jdbcUrl, final Properties props) {
|
||||
final String user;
|
||||
final String host;
|
||||
final Integer port;
|
||||
final String instance;
|
||||
|
||||
final String[] atSplit = jdbcUrl.split("@", 2);
|
||||
|
||||
final int userInfoLoc = atSplit[0].indexOf("/");
|
||||
if (userInfoLoc > 0) {
|
||||
user = atSplit[0].substring(0, userInfoLoc);
|
||||
} else {
|
||||
user = null;
|
||||
}
|
||||
|
||||
final String description = atSplit[1];
|
||||
final Matcher hostMatcher = HOST_REGEX.matcher(description);
|
||||
final Matcher portMatcher = PORT_REGEX.matcher(description);
|
||||
final Matcher instanceMatcher = INSTANCE_REGEX.matcher(description);
|
||||
if (hostMatcher.find()) {
|
||||
host = hostMatcher.group(1);
|
||||
} else {
|
||||
host = null;
|
||||
}
|
||||
if (portMatcher.find()) {
|
||||
port = Integer.parseInt(portMatcher.group(1));
|
||||
} else {
|
||||
port = null;
|
||||
}
|
||||
if (instanceMatcher.find()) {
|
||||
instance = instanceMatcher.group(1);
|
||||
} else {
|
||||
instance = null;
|
||||
}
|
||||
return new JDBCMaps.DBInfo(null, null, user, instance, null, host, port);
|
||||
}
|
||||
},
|
||||
|
||||
H2("h2") {
|
||||
private static final int DEFAULT_PORT = 8082;
|
||||
|
||||
|
@ -390,8 +559,8 @@ public enum JDBCConnectionUrlParser {
|
|||
String user = DEFAULT_USER;
|
||||
|
||||
if (props != null) {
|
||||
instance = props.getProperty("databasename");
|
||||
user = props.getProperty("user");
|
||||
instance = props.getProperty("databasename", instance);
|
||||
user = props.getProperty("user", user);
|
||||
}
|
||||
final String derbyUrl = jdbcUrl.substring("derby:".length());
|
||||
final String[] split = derbyUrl.split(";", 2);
|
||||
|
@ -510,11 +679,16 @@ public enum JDBCConnectionUrlParser {
|
|||
|
||||
final String baseType = jdbcUrl.substring(0, typeLoc);
|
||||
|
||||
if (typeParsers.containsKey(baseType)) {
|
||||
// Delegate to specific parser
|
||||
return typeParsers.get(baseType).doParse(jdbcUrl, props);
|
||||
try {
|
||||
if (typeParsers.containsKey(baseType)) {
|
||||
// Delegate to specific parser
|
||||
return typeParsers.get(baseType).doParse(jdbcUrl, props);
|
||||
}
|
||||
return GENERIC_URL_LIKE.doParse(connectionUrl, props);
|
||||
} catch (final Exception e) {
|
||||
ExceptionLogger.LOGGER.debug("Error parsing URL", e);
|
||||
return DEFAULT;
|
||||
}
|
||||
return GENERIC_URL_LIKE.doParse(connectionUrl, props);
|
||||
}
|
||||
|
||||
// Source: https://stackoverflow.com/a/13592567
|
||||
|
|
|
@ -20,6 +20,8 @@ import io.opentracing.noop.NoopScopeManager;
|
|||
import io.opentracing.util.GlobalTracer;
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import net.bytebuddy.asm.Advice;
|
||||
import net.bytebuddy.description.method.MethodDescription;
|
||||
|
@ -40,15 +42,23 @@ public final class PreparedStatementInstrumentation extends Instrumenter.Default
|
|||
|
||||
@Override
|
||||
public String[] helperClassNames() {
|
||||
return new String[] {
|
||||
"datadog.trace.agent.decorator.BaseDecorator",
|
||||
"datadog.trace.agent.decorator.ClientDecorator",
|
||||
"datadog.trace.agent.decorator.DatabaseClientDecorator",
|
||||
packageName + ".JDBCDecorator",
|
||||
packageName + ".JDBCMaps",
|
||||
packageName + ".JDBCMaps$DBInfo",
|
||||
packageName + ".JDBCUtils",
|
||||
};
|
||||
final JDBCConnectionUrlParser[] parsers = JDBCConnectionUrlParser.values();
|
||||
final List<String> parserClasses = new ArrayList<>(parsers.length + 8);
|
||||
|
||||
parserClasses.add(packageName + ".JDBCUtils");
|
||||
parserClasses.add(packageName + ".JDBCMaps");
|
||||
parserClasses.add(packageName + ".JDBCMaps$DBInfo");
|
||||
parserClasses.add(packageName + ".JDBCConnectionUrlParser");
|
||||
|
||||
parserClasses.add("datadog.trace.agent.decorator.BaseDecorator");
|
||||
parserClasses.add("datadog.trace.agent.decorator.ClientDecorator");
|
||||
parserClasses.add("datadog.trace.agent.decorator.DatabaseClientDecorator");
|
||||
parserClasses.add(packageName + ".JDBCDecorator");
|
||||
|
||||
for (final JDBCConnectionUrlParser parser : parsers) {
|
||||
parserClasses.add(parser.getClass().getName());
|
||||
}
|
||||
return parserClasses.toArray(new String[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -20,6 +20,8 @@ import io.opentracing.noop.NoopScopeManager;
|
|||
import io.opentracing.util.GlobalTracer;
|
||||
import java.sql.Connection;
|
||||
import java.sql.Statement;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import net.bytebuddy.asm.Advice;
|
||||
import net.bytebuddy.description.method.MethodDescription;
|
||||
|
@ -40,15 +42,23 @@ public final class StatementInstrumentation extends Instrumenter.Default {
|
|||
|
||||
@Override
|
||||
public String[] helperClassNames() {
|
||||
return new String[] {
|
||||
"datadog.trace.agent.decorator.BaseDecorator",
|
||||
"datadog.trace.agent.decorator.ClientDecorator",
|
||||
"datadog.trace.agent.decorator.DatabaseClientDecorator",
|
||||
packageName + ".JDBCDecorator",
|
||||
packageName + ".JDBCMaps",
|
||||
packageName + ".JDBCMaps$DBInfo",
|
||||
packageName + ".JDBCUtils",
|
||||
};
|
||||
final JDBCConnectionUrlParser[] parsers = JDBCConnectionUrlParser.values();
|
||||
final List<String> parserClasses = new ArrayList<>(parsers.length + 8);
|
||||
|
||||
parserClasses.add(packageName + ".JDBCUtils");
|
||||
parserClasses.add(packageName + ".JDBCMaps");
|
||||
parserClasses.add(packageName + ".JDBCMaps$DBInfo");
|
||||
parserClasses.add(packageName + ".JDBCConnectionUrlParser");
|
||||
|
||||
parserClasses.add("datadog.trace.agent.decorator.BaseDecorator");
|
||||
parserClasses.add("datadog.trace.agent.decorator.ClientDecorator");
|
||||
parserClasses.add("datadog.trace.agent.decorator.DatabaseClientDecorator");
|
||||
parserClasses.add(packageName + ".JDBCDecorator");
|
||||
|
||||
for (final JDBCConnectionUrlParser parser : parsers) {
|
||||
parserClasses.add(parser.getClass().getName());
|
||||
}
|
||||
return parserClasses.toArray(new String[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -31,83 +31,96 @@ class JDBCConnectionUrlParserTest extends Specification {
|
|||
info == expected
|
||||
|
||||
where:
|
||||
url | format | user | host | port | instance
|
||||
url | format | user | host | port | instance
|
||||
// https://jdbc.postgresql.org/documentation/94/connect.html
|
||||
"jdbc:postgresql:///" | "postgresql" | null | "localhost" | 5432 | ""
|
||||
"jdbc:postgresql://pghost" | "postgresql" | null | "pghost" | 5432 | ""
|
||||
"jdbc:postgresql://pghost:11/pgdb?user=pguser&password=PW" | "postgresql" | "pguser" | "pghost" | 11 | "pgdb"
|
||||
"jdbc:postgresql:///" | "postgresql" | null | "localhost" | 5432 | ""
|
||||
"jdbc:postgresql://pghost" | "postgresql" | null | "pghost" | 5432 | ""
|
||||
"jdbc:postgresql://pghost:11/pgdb?user=pguser&password=PW" | "postgresql" | "pguser" | "pghost" | 11 | "pgdb"
|
||||
|
||||
// https://dev.mysql.com/doc/connector-j/8.0/en/connector-j-reference-configuration-properties.html
|
||||
"jdbc:mysql:///" | "mysql" | null | "localhost" | 3306 | ""
|
||||
"jdbc:mysql://myhost" | "mysql" | null | "myhost" | 3306 | ""
|
||||
"jdbc:mysql://myhost?user=myuser&password=PW" | "mysql" | "myuser" | "myhost" | 3306 | ""
|
||||
"jdbc:mysql://myhost:22/mydb?user=myuser&password=PW" | "mysql" | "myuser" | "myhost" | 22 | "mydb"
|
||||
"jdbc:mariadb://mdbhost:33/mdbdb?user=mdbuser&password=PW" | "mariadb" | "mdbuser" | "mdbhost" | 33 | "mdbdb"
|
||||
"jdbc:mysql:///" | "mysql" | null | "localhost" | 3306 | ""
|
||||
"jdbc:mysql://myhost" | "mysql" | null | "myhost" | 3306 | ""
|
||||
"jdbc:mysql://myhost?user=myuser&password=PW" | "mysql" | "myuser" | "myhost" | 3306 | ""
|
||||
"jdbc:mysql://myhost:22/mydb?user=myuser&password=PW" | "mysql" | "myuser" | "myhost" | 22 | "mydb"
|
||||
"jdbc:mariadb://mdbhost:33/mdbdb?user=mdbuser&password=PW" | "mariadb" | "mdbuser" | "mdbhost" | 33 | "mdbdb"
|
||||
|
||||
//https://docs.microsoft.com/en-us/sql/connect/jdbc/building-the-connection-url
|
||||
"jdbc:microsoft:sqlserver://;" | "sqlserver" | null | "localhost" | 1433 | "MSSQLSERVER"
|
||||
"jdbc:sqlserver://sshost\\ssinstance:44;databaseName=ssdb;user=ssuser;password=pw" | "sqlserver" | "ssuser" | "sshost" | 44 | "ssinstance"
|
||||
"jdbc:sqlserver://;serverName=sshost\\ssinstance:44;DatabaseName=;" | "sqlserver" | null | "sshost" | 44 | "ssinstance"
|
||||
"jdbc:sqlserver://sshost;serverName=althost;DatabaseName=ssdb;" | "sqlserver" | null | "sshost" | 1433 | "MSSQLSERVER"
|
||||
"jdbc:microsoft:sqlserver://sshost:44;DatabaseName=ssdb;user=ssuser;password=pw;user=ssuser2;" | "sqlserver" | "ssuser" | "sshost" | 44 | "MSSQLSERVER"
|
||||
"jdbc:microsoft:sqlserver://;" | "sqlserver" | null | "localhost" | 1433 | "MSSQLSERVER"
|
||||
"jdbc:sqlserver://sshost\\ssinstance:44;databaseName=ssdb;user=ssuser;password=pw" | "sqlserver" | "ssuser" | "sshost" | 44 | "ssinstance"
|
||||
"jdbc:sqlserver://;serverName=sshost\\ssinstance:44;DatabaseName=;" | "sqlserver" | null | "sshost" | 44 | "ssinstance"
|
||||
"jdbc:sqlserver://sshost;serverName=althost;DatabaseName=ssdb;" | "sqlserver" | null | "sshost" | 1433 | "MSSQLSERVER"
|
||||
"jdbc:microsoft:sqlserver://sshost:44;DatabaseName=ssdb;user=ssuser;password=pw;user=ssuser2;" | "sqlserver" | "ssuser" | "sshost" | 44 | "MSSQLSERVER"
|
||||
|
||||
// TODO:
|
||||
// "jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST= localhost )(PORT= 1521))" +
|
||||
// "(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)))" | "oracle" | "orcluser" | "orclhost" | 55 | "orcldb"
|
||||
// "jdbc:oracle:drivertype:orcluser/PW@orclhost:55/orcldb" | "oracle" | "orcluser" | "orclhost" | 55 | "orcldb"
|
||||
// https://docs.oracle.com/cd/B28359_01/java.111/b31224/urls.htm
|
||||
// https://docs.oracle.com/cd/B28359_01/java.111/b31224/jdbcthin.htm
|
||||
"jdbc:oracle:thin:orcluser/PW@localhost:55:orclsn" | "oracle:thin" | "orcluser" | "localhost" | 55 | "orclsn"
|
||||
"jdbc:oracle:thin:orcluser/PW@//orclhost:55/orclsn" | "oracle:thin" | "orcluser" | "orclhost" | 55 | "orclsn"
|
||||
"jdbc:oracle:thin:orcluser/PW@127.0.0.1:orclsn" | "oracle:thin" | "orcluser" | "127.0.0.1" | 1521 | "orclsn"
|
||||
"jdbc:oracle:thin:orcluser/PW@//orclhost/orclsn" | "oracle:thin" | "orcluser" | "orclhost" | 1521 | "orclsn"
|
||||
"jdbc:oracle:thin:@//orclhost:55/orclsn" | "oracle:thin" | null | "orclhost" | 55 | "orclsn"
|
||||
"jdbc:oracle:thin:@ldap://orclhost:55/some,cn=OracleContext,dc=com" | "oracle:thin" | null | "orclhost" | 55 | "some,cn=oraclecontext,dc=com"
|
||||
"jdbc:oracle:thin:127.0.0.1:orclsn" | "oracle:thin" | null | "127.0.0.1" | 1521 | "orclsn"
|
||||
"jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST= 127.0.0.1 )(POR T= 666))" +
|
||||
"(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orclsn)))" | "oracle:thin" | null | "127.0.0.1" | 1521 | "orclsn"
|
||||
// https://docs.oracle.com/cd/B28359_01/java.111/b31224/instclnt.htm
|
||||
"jdbc:oracle:drivertype:orcluser/PW@orclhost:55/orclsn" | "oracle:drivertype" | "orcluser" | "orclhost" | 55 | "orclsn"
|
||||
"jdbc:oracle:oci8:@" | "oracle:oci8" | null | null | 1521 | null
|
||||
"jdbc:oracle:oci8:@orclsn" | "oracle:oci8" | null | null | 1521 | "orclsn"
|
||||
"jdbc:oracle:oci:@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)( HOST = orclhost )" +
|
||||
"( PORT = 55 ))(CONNECT_DATA=(SERVICE_NAME =orclsn )))" | "oracle:oci" | null | "orclhost" | 55 | "orclsn"
|
||||
|
||||
// https://www.ibm.com/support/knowledgecenter/en/SSEPEK_10.0.0/java/src/tpc/imjcc_tjvjcccn.html
|
||||
// https://www.ibm.com/support/knowledgecenter/en/SSEPGG_10.5.0/com.ibm.db2.luw.apdv.java.doc/src/tpc/imjcc_r0052342.html
|
||||
"jdbc:as400://ashost:66/asdb:user=asuser;password=PW;" | "as400" | "asuser" | "ashost" | 66 | "asdb"
|
||||
"jdbc:db2://db2host:77/db2db:user=db2user;password=PW;" | "db2" | "db2user" | "db2host" | 77 | "db2db"
|
||||
"jdbc:as400://ashost:66/asdb:user=asuser;password=PW;" | "as400" | "asuser" | "ashost" | 66 | "asdb"
|
||||
"jdbc:db2://db2host:77/db2db:user=db2user;password=PW;" | "db2" | "db2user" | "db2host" | 77 | "db2db"
|
||||
|
||||
// https://help.sap.com/viewer/0eec0d68141541d1b07893a39944924e/2.0.03/en-US/ff15928cf5594d78b841fbbe649f04b4.html
|
||||
"jdbc:sap://saphost:88/?databaseName=sapdb&user=sapuser&password=PW" | "sap" | "sapuser" | "saphost" | 88 | "sapdb"
|
||||
"jdbc:sap://saphost:88/?databaseName=sapdb&user=sapuser&password=PW" | "sap" | "sapuser" | "saphost" | 88 | "sapdb"
|
||||
|
||||
// TODO:
|
||||
// "jdbc:informix-sqli://infxhost:99/infxdb:INFORMIXSERVER=infxsn;user=infxuser;password=PW" | "informix-sqli" | "infxuser" | "infxhost" | 99 | "infxdb"
|
||||
// "jdbc:informix-direct://infxdb:999;user=infxuser;password=PW" | "informix-direct" | "infxuser" | "infxhost" | 999 | "infxdb"
|
||||
|
||||
// http://www.h2database.com/html/features.html#database_url
|
||||
"jdbc:h2:mem:" | "h2:mem" | null | null | null | ""
|
||||
"jdbc:h2:mem:h2db" | "h2:mem" | null | null | null | "h2db"
|
||||
"jdbc:h2:tcp://h2host:111/path/h2db;user=h2user;password=PW" | "h2:tcp" | "h2user" | "h2host" | 111 | "path/h2db"
|
||||
"jdbc:h2:ssl://h2host:111/path/h2db;user=h2user;password=PW" | "h2:ssl" | "h2user" | "h2host" | 111 | "path/h2db"
|
||||
"jdbc:h2:/data/h2file" | "h2:file" | null | null | null | "/data/h2file"
|
||||
"jdbc:h2:file:~/h2file;USER=h2user;PASSWORD=PW" | "h2:file" | null | null | null | "~/h2file"
|
||||
"jdbc:h2:file:/data/h2file" | "h2:file" | null | null | null | "/data/h2file"
|
||||
"jdbc:h2:file:C:/data/h2file" | "h2:file" | null | null | null | "c:/data/h2file"
|
||||
"jdbc:h2:zip:~/db.zip!/h2zip" | "h2:zip" | null | null | null | "~/db.zip!/h2zip"
|
||||
"jdbc:h2:mem:" | "h2:mem" | null | null | null | ""
|
||||
"jdbc:h2:mem:h2db" | "h2:mem" | null | null | null | "h2db"
|
||||
"jdbc:h2:tcp://h2host:111/path/h2db;user=h2user;password=PW" | "h2:tcp" | "h2user" | "h2host" | 111 | "path/h2db"
|
||||
"jdbc:h2:ssl://h2host:111/path/h2db;user=h2user;password=PW" | "h2:ssl" | "h2user" | "h2host" | 111 | "path/h2db"
|
||||
"jdbc:h2:/data/h2file" | "h2:file" | null | null | null | "/data/h2file"
|
||||
"jdbc:h2:file:~/h2file;USER=h2user;PASSWORD=PW" | "h2:file" | null | null | null | "~/h2file"
|
||||
"jdbc:h2:file:/data/h2file" | "h2:file" | null | null | null | "/data/h2file"
|
||||
"jdbc:h2:file:C:/data/h2file" | "h2:file" | null | null | null | "c:/data/h2file"
|
||||
"jdbc:h2:zip:~/db.zip!/h2zip" | "h2:zip" | null | null | null | "~/db.zip!/h2zip"
|
||||
|
||||
// http://hsqldb.org/doc/2.0/guide/dbproperties-chapt.html
|
||||
"jdbc:hsqldb:hsdb" | "hsqldb:mem" | "SA" | null | null | "hsdb"
|
||||
"jdbc:hsqldb:mem:hsdb" | "hsqldb:mem" | "SA" | null | null | "hsdb"
|
||||
"jdbc:hsqldb:file:hsdb" | "hsqldb:file" | "SA" | null | null | "hsdb"
|
||||
"jdbc:hsqldb:file:/loc/hsdb" | "hsqldb:file" | "SA" | null | null | "/loc/hsdb"
|
||||
"jdbc:hsqldb:file:C:/hsdb" | "hsqldb:file" | "SA" | null | null | "c:/hsdb"
|
||||
"jdbc:hsqldb:res:hsdb" | "hsqldb:res" | "SA" | null | null | "hsdb"
|
||||
"jdbc:hsqldb:res:/cp/hsdb" | "hsqldb:res" | "SA" | null | null | "/cp/hsdb"
|
||||
"jdbc:hsqldb:hsql://hshost:333/hsdb" | "hsqldb:hsql" | "SA" | "hshost" | 333 | "hsdb"
|
||||
"jdbc:hsqldb:hsqls://hshost/hsdb" | "hsqldb:hsqls" | "SA" | "hshost" | 9001 | "hsdb"
|
||||
"jdbc:hsqldb:http://hshost" | "hsqldb:http" | "SA" | "hshost" | 80 | null
|
||||
"jdbc:hsqldb:http://hshost:333/hsdb" | "hsqldb:http" | "SA" | "hshost" | 333 | "hsdb"
|
||||
"jdbc:hsqldb:https://127.0.0.1/hsdb" | "hsqldb:https" | "SA" | "127.0.0.1" | 443 | "hsdb"
|
||||
"jdbc:hsqldb:hsdb" | "hsqldb:mem" | "SA" | null | null | "hsdb"
|
||||
"jdbc:hsqldb:mem:hsdb" | "hsqldb:mem" | "SA" | null | null | "hsdb"
|
||||
"jdbc:hsqldb:file:hsdb" | "hsqldb:file" | "SA" | null | null | "hsdb"
|
||||
"jdbc:hsqldb:file:/loc/hsdb" | "hsqldb:file" | "SA" | null | null | "/loc/hsdb"
|
||||
"jdbc:hsqldb:file:C:/hsdb" | "hsqldb:file" | "SA" | null | null | "c:/hsdb"
|
||||
"jdbc:hsqldb:res:hsdb" | "hsqldb:res" | "SA" | null | null | "hsdb"
|
||||
"jdbc:hsqldb:res:/cp/hsdb" | "hsqldb:res" | "SA" | null | null | "/cp/hsdb"
|
||||
"jdbc:hsqldb:hsql://hshost:333/hsdb" | "hsqldb:hsql" | "SA" | "hshost" | 333 | "hsdb"
|
||||
"jdbc:hsqldb:hsqls://hshost/hsdb" | "hsqldb:hsqls" | "SA" | "hshost" | 9001 | "hsdb"
|
||||
"jdbc:hsqldb:http://hshost" | "hsqldb:http" | "SA" | "hshost" | 80 | null
|
||||
"jdbc:hsqldb:http://hshost:333/hsdb" | "hsqldb:http" | "SA" | "hshost" | 333 | "hsdb"
|
||||
"jdbc:hsqldb:https://127.0.0.1/hsdb" | "hsqldb:https" | "SA" | "127.0.0.1" | 443 | "hsdb"
|
||||
|
||||
// https://db.apache.org/derby/papers/DerbyClientSpec.html#Connection+URL+Format
|
||||
// https://db.apache.org/derby/docs/10.8/devguide/cdevdvlp34964.html
|
||||
"jdbc:derby:derbydb" | "derby:directory" | "APP" | null | null | "derbydb"
|
||||
"jdbc:derby:derbydb;user=derbyuser;password=pw" | "derby:directory" | "derbyuser" | null | null | "derbydb"
|
||||
"jdbc:derby:memory:derbydb" | "derby:memory" | "APP" | null | null | "derbydb"
|
||||
"jdbc:derby:memory:;databaseName=derbydb" | "derby:memory" | "APP" | null | null | "derbydb"
|
||||
"jdbc:derby:memory:derbydb;databaseName=altdb" | "derby:memory" | "APP" | null | null | "derbydb"
|
||||
"jdbc:derby:memory:derbydb;user=derbyuser;password=pw" | "derby:memory" | "derbyuser" | null | null | "derbydb"
|
||||
"jdbc:derby://derbyhost:222/memory:derbydb;create=true" | "derby:network" | "APP" | "derbyhost" | 222 | "derbydb"
|
||||
"jdbc:derby://derbyhost/memory:derbydb;create=true;user=derbyuser;password=pw" | "derby:network" | "derbyuser" | "derbyhost" | 1527 | "derbydb"
|
||||
"jdbc:derby://127.0.0.1:1527/memory:derbydb;create=true;user=derbyuser;password=pw" | "derby:network" | "derbyuser" | "127.0.0.1" | 1527 | "derbydb"
|
||||
"jdbc:derby:directory:derbydb;user=derbyuser;password=pw" | "derby:directory" | "derbyuser" | null | null | "derbydb"
|
||||
"jdbc:derby:classpath:/some/derbydb;user=derbyuser;password=pw" | "derby:classpath" | "derbyuser" | null | null | "/some/derbydb"
|
||||
"jdbc:derby:jar:/derbydb;user=derbyuser;password=pw" | "derby:jar" | "derbyuser" | null | null | "/derbydb"
|
||||
"jdbc:derby:jar:(~/path/to/db.jar)/other/derbydb;user=derbyuser;password=pw" | "derby:jar" | "derbyuser" | null | null | "(~/path/to/db.jar)/other/derbydb"
|
||||
"jdbc:derby:derbydb" | "derby:directory" | "APP" | null | null | "derbydb"
|
||||
"jdbc:derby:derbydb;user=derbyuser;password=pw" | "derby:directory" | "derbyuser" | null | null | "derbydb"
|
||||
"jdbc:derby:memory:derbydb" | "derby:memory" | "APP" | null | null | "derbydb"
|
||||
"jdbc:derby:memory:;databaseName=derbydb" | "derby:memory" | "APP" | null | null | "derbydb"
|
||||
"jdbc:derby:memory:derbydb;databaseName=altdb" | "derby:memory" | "APP" | null | null | "derbydb"
|
||||
"jdbc:derby:memory:derbydb;user=derbyuser;password=pw" | "derby:memory" | "derbyuser" | null | null | "derbydb"
|
||||
"jdbc:derby://derbyhost:222/memory:derbydb;create=true" | "derby:network" | "APP" | "derbyhost" | 222 | "derbydb"
|
||||
"jdbc:derby://derbyhost/memory:derbydb;create=true;user=derbyuser;password=pw" | "derby:network" | "derbyuser" | "derbyhost" | 1527 | "derbydb"
|
||||
"jdbc:derby://127.0.0.1:1527/memory:derbydb;create=true;user=derbyuser;password=pw" | "derby:network" | "derbyuser" | "127.0.0.1" | 1527 | "derbydb"
|
||||
"jdbc:derby:directory:derbydb;user=derbyuser;password=pw" | "derby:directory" | "derbyuser" | null | null | "derbydb"
|
||||
"jdbc:derby:classpath:/some/derbydb;user=derbyuser;password=pw" | "derby:classpath" | "derbyuser" | null | null | "/some/derbydb"
|
||||
"jdbc:derby:jar:/derbydb;user=derbyuser;password=pw" | "derby:jar" | "derbyuser" | null | null | "/derbydb"
|
||||
"jdbc:derby:jar:(~/path/to/db.jar)/other/derbydb;user=derbyuser;password=pw" | "derby:jar" | "derbyuser" | null | null | "(~/path/to/db.jar)/other/derbydb"
|
||||
|
||||
expected = new JDBCMaps.DBInfo(format, null, user, instance, null, host, port)
|
||||
}
|
||||
|
|
|
@ -26,23 +26,23 @@ class JDBCInstrumentationTest extends AgentTestRunner {
|
|||
|
||||
@Shared
|
||||
private Map<String, String> jdbcUrls = [
|
||||
h2 : "jdbc:h2:mem:$dbName",
|
||||
derby : "jdbc:derby:memory:$dbName",
|
||||
hsqldb: "jdbc:hsqldb:mem:$dbName",
|
||||
"h2:mem" : "jdbc:h2:mem:$dbName",
|
||||
"derby:memory": "jdbc:derby:memory:$dbName",
|
||||
"hsqldb:mem" : "jdbc:hsqldb:mem:$dbName",
|
||||
]
|
||||
|
||||
@Shared
|
||||
private Map<String, String> jdbcDriverClassNames = [
|
||||
h2 : "org.h2.Driver",
|
||||
derby : "org.apache.derby.jdbc.EmbeddedDriver",
|
||||
hsqldb: "org.hsqldb.jdbc.JDBCDriver",
|
||||
"h2:mem" : "org.h2.Driver",
|
||||
"derby:memory": "org.apache.derby.jdbc.EmbeddedDriver",
|
||||
"hsqldb:mem" : "org.hsqldb.jdbc.JDBCDriver",
|
||||
]
|
||||
|
||||
@Shared
|
||||
private Map<String, String> jdbcUserNames = [
|
||||
h2 : null,
|
||||
derby : "APP",
|
||||
hsqldb: "SA",
|
||||
"h2:mem" : null,
|
||||
"derby:memory": "APP",
|
||||
"hsqldb:mem" : "SA",
|
||||
]
|
||||
|
||||
@Shared
|
||||
|
@ -76,7 +76,7 @@ class JDBCInstrumentationTest extends AgentTestRunner {
|
|||
|
||||
def createTomcatDS(String dbType, String jdbcUrl) {
|
||||
DataSource ds = new org.apache.tomcat.jdbc.pool.DataSource()
|
||||
def jdbcUrlToSet = dbType == "derby" ? jdbcUrl + ";create=true" : jdbcUrl
|
||||
def jdbcUrlToSet = dbType == "derby:memory" ? jdbcUrl + ";create=true" : jdbcUrl
|
||||
ds.setUrl(jdbcUrlToSet)
|
||||
ds.setDriverClassName(jdbcDriverClassNames.get(dbType))
|
||||
String username = jdbcUserNames.get(dbType)
|
||||
|
@ -91,7 +91,7 @@ class JDBCInstrumentationTest extends AgentTestRunner {
|
|||
|
||||
def createHikariDS(String dbType, String jdbcUrl) {
|
||||
HikariConfig config = new HikariConfig()
|
||||
def jdbcUrlToSet = dbType == "derby" ? jdbcUrl + ";create=true" : jdbcUrl
|
||||
def jdbcUrlToSet = dbType == "derby:memory" ? jdbcUrl + ";create=true" : jdbcUrl
|
||||
config.setJdbcUrl(jdbcUrlToSet)
|
||||
String username = jdbcUserNames.get(dbType)
|
||||
if (username != null) {
|
||||
|
@ -109,7 +109,7 @@ class JDBCInstrumentationTest extends AgentTestRunner {
|
|||
def createC3P0DS(String dbType, String jdbcUrl) {
|
||||
DataSource ds = new ComboPooledDataSource()
|
||||
ds.setDriverClass(jdbcDriverClassNames.get(dbType))
|
||||
def jdbcUrlToSet = dbType == "derby" ? jdbcUrl + ";create=true" : jdbcUrl
|
||||
def jdbcUrlToSet = dbType == "derby:memory" ? jdbcUrl + ";create=true" : jdbcUrl
|
||||
ds.setJdbcUrl(jdbcUrlToSet)
|
||||
String username = jdbcUserNames.get(dbType)
|
||||
if (username != null) {
|
||||
|
@ -193,22 +193,22 @@ class JDBCInstrumentationTest extends AgentTestRunner {
|
|||
connection.close()
|
||||
|
||||
where:
|
||||
driver | connection | username | query
|
||||
"h2" | new Driver().connect(jdbcUrls.get("h2"), null) | null | "SELECT 3"
|
||||
"derby" | new EmbeddedDriver().connect(jdbcUrls.get("derby"), null) | "APP" | "SELECT 3 FROM SYSIBM.SYSDUMMY1"
|
||||
"hsqldb" | new JDBCDriver().connect(jdbcUrls.get("hsqldb"), null) | "SA" | "SELECT 3 FROM INFORMATION_SCHEMA.SYSTEM_USERS"
|
||||
"h2" | new Driver().connect(jdbcUrls.get("h2"), connectionProps) | null | "SELECT 3"
|
||||
"derby" | new EmbeddedDriver().connect(jdbcUrls.get("derby"), connectionProps) | "APP" | "SELECT 3 FROM SYSIBM.SYSDUMMY1"
|
||||
"hsqldb" | new JDBCDriver().connect(jdbcUrls.get("hsqldb"), connectionProps) | "SA" | "SELECT 3 FROM INFORMATION_SCHEMA.SYSTEM_USERS"
|
||||
"h2" | cpDatasources.get("tomcat").get("h2").getConnection() | null | "SELECT 3"
|
||||
"derby" | cpDatasources.get("tomcat").get("derby").getConnection() | "APP" | "SELECT 3 FROM SYSIBM.SYSDUMMY1"
|
||||
"hsqldb" | cpDatasources.get("tomcat").get("hsqldb").getConnection() | "SA" | "SELECT 3 FROM INFORMATION_SCHEMA.SYSTEM_USERS"
|
||||
"h2" | cpDatasources.get("hikari").get("h2").getConnection() | null | "SELECT 3"
|
||||
"derby" | cpDatasources.get("hikari").get("derby").getConnection() | "APP" | "SELECT 3 FROM SYSIBM.SYSDUMMY1"
|
||||
"hsqldb" | cpDatasources.get("hikari").get("hsqldb").getConnection() | "SA" | "SELECT 3 FROM INFORMATION_SCHEMA.SYSTEM_USERS"
|
||||
"h2" | cpDatasources.get("c3p0").get("h2").getConnection() | null | "SELECT 3"
|
||||
"derby" | cpDatasources.get("c3p0").get("derby").getConnection() | "APP" | "SELECT 3 FROM SYSIBM.SYSDUMMY1"
|
||||
"hsqldb" | cpDatasources.get("c3p0").get("hsqldb").getConnection() | "SA" | "SELECT 3 FROM INFORMATION_SCHEMA.SYSTEM_USERS"
|
||||
driver | connection | username | query
|
||||
"h2:mem" | new Driver().connect(jdbcUrls.get("h2:mem"), null) | null | "SELECT 3"
|
||||
"derby:memory" | new EmbeddedDriver().connect(jdbcUrls.get("derby:memory"), null) | "APP" | "SELECT 3 FROM SYSIBM.SYSDUMMY1"
|
||||
"hsqldb:mem" | new JDBCDriver().connect(jdbcUrls.get("hsqldb:mem"), null) | "SA" | "SELECT 3 FROM INFORMATION_SCHEMA.SYSTEM_USERS"
|
||||
"h2:mem" | new Driver().connect(jdbcUrls.get("h2:mem"), connectionProps) | null | "SELECT 3"
|
||||
"derby:memory" | new EmbeddedDriver().connect(jdbcUrls.get("derby:memory"), connectionProps) | "APP" | "SELECT 3 FROM SYSIBM.SYSDUMMY1"
|
||||
"hsqldb:mem" | new JDBCDriver().connect(jdbcUrls.get("hsqldb:mem"), connectionProps) | "SA" | "SELECT 3 FROM INFORMATION_SCHEMA.SYSTEM_USERS"
|
||||
"h2:mem" | cpDatasources.get("tomcat").get("h2:mem").getConnection() | null | "SELECT 3"
|
||||
"derby:memory" | cpDatasources.get("tomcat").get("derby:memory").getConnection() | "APP" | "SELECT 3 FROM SYSIBM.SYSDUMMY1"
|
||||
"hsqldb:mem" | cpDatasources.get("tomcat").get("hsqldb:mem").getConnection() | "SA" | "SELECT 3 FROM INFORMATION_SCHEMA.SYSTEM_USERS"
|
||||
"h2:mem" | cpDatasources.get("hikari").get("h2:mem").getConnection() | null | "SELECT 3"
|
||||
"derby:memory" | cpDatasources.get("hikari").get("derby:memory").getConnection() | "APP" | "SELECT 3 FROM SYSIBM.SYSDUMMY1"
|
||||
"hsqldb:mem" | cpDatasources.get("hikari").get("hsqldb:mem").getConnection() | "SA" | "SELECT 3 FROM INFORMATION_SCHEMA.SYSTEM_USERS"
|
||||
"h2:mem" | cpDatasources.get("c3p0").get("h2:mem").getConnection() | null | "SELECT 3"
|
||||
"derby:memory" | cpDatasources.get("c3p0").get("derby:memory").getConnection() | "APP" | "SELECT 3 FROM SYSIBM.SYSDUMMY1"
|
||||
"hsqldb:mem" | cpDatasources.get("c3p0").get("hsqldb:mem").getConnection() | "SA" | "SELECT 3 FROM INFORMATION_SCHEMA.SYSTEM_USERS"
|
||||
}
|
||||
|
||||
@Unroll
|
||||
|
@ -256,15 +256,15 @@ class JDBCInstrumentationTest extends AgentTestRunner {
|
|||
connection.close()
|
||||
|
||||
where:
|
||||
driver | connection | username | query
|
||||
"h2" | new Driver().connect(jdbcUrls.get("h2"), null) | null | "SELECT 3"
|
||||
"derby" | new EmbeddedDriver().connect(jdbcUrls.get("derby"), null) | "APP" | "SELECT 3 FROM SYSIBM.SYSDUMMY1"
|
||||
"h2" | cpDatasources.get("tomcat").get("h2").getConnection() | null | "SELECT 3"
|
||||
"derby" | cpDatasources.get("tomcat").get("derby").getConnection() | "APP" | "SELECT 3 FROM SYSIBM.SYSDUMMY1"
|
||||
"h2" | cpDatasources.get("hikari").get("h2").getConnection() | null | "SELECT 3"
|
||||
"derby" | cpDatasources.get("hikari").get("derby").getConnection() | "APP" | "SELECT 3 FROM SYSIBM.SYSDUMMY1"
|
||||
"h2" | cpDatasources.get("c3p0").get("h2").getConnection() | null | "SELECT 3"
|
||||
"derby" | cpDatasources.get("c3p0").get("derby").getConnection() | "APP" | "SELECT 3 FROM SYSIBM.SYSDUMMY1"
|
||||
driver | connection | username | query
|
||||
"h2:mem" | new Driver().connect(jdbcUrls.get("h2:mem"), null) | null | "SELECT 3"
|
||||
"derby:memory" | new EmbeddedDriver().connect(jdbcUrls.get("derby:memory"), null) | "APP" | "SELECT 3 FROM SYSIBM.SYSDUMMY1"
|
||||
"h2:mem" | cpDatasources.get("tomcat").get("h2:mem").getConnection() | null | "SELECT 3"
|
||||
"derby:memory" | cpDatasources.get("tomcat").get("derby:memory").getConnection() | "APP" | "SELECT 3 FROM SYSIBM.SYSDUMMY1"
|
||||
"h2:mem" | cpDatasources.get("hikari").get("h2:mem").getConnection() | null | "SELECT 3"
|
||||
"derby:memory" | cpDatasources.get("hikari").get("derby:memory").getConnection() | "APP" | "SELECT 3 FROM SYSIBM.SYSDUMMY1"
|
||||
"h2:mem" | cpDatasources.get("c3p0").get("h2:mem").getConnection() | null | "SELECT 3"
|
||||
"derby:memory" | cpDatasources.get("c3p0").get("derby:memory").getConnection() | "APP" | "SELECT 3 FROM SYSIBM.SYSDUMMY1"
|
||||
}
|
||||
|
||||
@Unroll
|
||||
|
@ -311,15 +311,15 @@ class JDBCInstrumentationTest extends AgentTestRunner {
|
|||
connection.close()
|
||||
|
||||
where:
|
||||
driver | connection | username | query
|
||||
"h2" | new Driver().connect(jdbcUrls.get("h2"), null) | null | "SELECT 3"
|
||||
"derby" | new EmbeddedDriver().connect(jdbcUrls.get("derby"), null) | "APP" | "SELECT 3 FROM SYSIBM.SYSDUMMY1"
|
||||
"h2" | cpDatasources.get("tomcat").get("h2").getConnection() | null | "SELECT 3"
|
||||
"derby" | cpDatasources.get("tomcat").get("derby").getConnection() | "APP" | "SELECT 3 FROM SYSIBM.SYSDUMMY1"
|
||||
"h2" | cpDatasources.get("hikari").get("h2").getConnection() | null | "SELECT 3"
|
||||
"derby" | cpDatasources.get("hikari").get("derby").getConnection() | "APP" | "SELECT 3 FROM SYSIBM.SYSDUMMY1"
|
||||
"h2" | cpDatasources.get("c3p0").get("h2").getConnection() | null | "SELECT 3"
|
||||
"derby" | cpDatasources.get("c3p0").get("derby").getConnection() | "APP" | "SELECT 3 FROM SYSIBM.SYSDUMMY1"
|
||||
driver | connection | username | query
|
||||
"h2:mem" | new Driver().connect(jdbcUrls.get("h2:mem"), null) | null | "SELECT 3"
|
||||
"derby:memory" | new EmbeddedDriver().connect(jdbcUrls.get("derby:memory"), null) | "APP" | "SELECT 3 FROM SYSIBM.SYSDUMMY1"
|
||||
"h2:mem" | cpDatasources.get("tomcat").get("h2:mem").getConnection() | null | "SELECT 3"
|
||||
"derby:memory" | cpDatasources.get("tomcat").get("derby:memory").getConnection() | "APP" | "SELECT 3 FROM SYSIBM.SYSDUMMY1"
|
||||
"h2:mem" | cpDatasources.get("hikari").get("h2:mem").getConnection() | null | "SELECT 3"
|
||||
"derby:memory" | cpDatasources.get("hikari").get("derby:memory").getConnection() | "APP" | "SELECT 3 FROM SYSIBM.SYSDUMMY1"
|
||||
"h2:mem" | cpDatasources.get("c3p0").get("h2:mem").getConnection() | null | "SELECT 3"
|
||||
"derby:memory" | cpDatasources.get("c3p0").get("derby:memory").getConnection() | "APP" | "SELECT 3 FROM SYSIBM.SYSDUMMY1"
|
||||
}
|
||||
|
||||
@Unroll
|
||||
|
@ -366,15 +366,15 @@ class JDBCInstrumentationTest extends AgentTestRunner {
|
|||
connection.close()
|
||||
|
||||
where:
|
||||
driver | connection | username | query
|
||||
"h2" | new Driver().connect(jdbcUrls.get("h2"), null) | null | "SELECT 3"
|
||||
"derby" | new EmbeddedDriver().connect(jdbcUrls.get("derby"), null) | "APP" | "SELECT 3 FROM SYSIBM.SYSDUMMY1"
|
||||
"h2" | cpDatasources.get("tomcat").get("h2").getConnection() | null | "SELECT 3"
|
||||
"derby" | cpDatasources.get("tomcat").get("derby").getConnection() | "APP" | "SELECT 3 FROM SYSIBM.SYSDUMMY1"
|
||||
"h2" | cpDatasources.get("hikari").get("h2").getConnection() | null | "SELECT 3"
|
||||
"derby" | cpDatasources.get("hikari").get("derby").getConnection() | "APP" | "SELECT 3 FROM SYSIBM.SYSDUMMY1"
|
||||
"h2" | cpDatasources.get("c3p0").get("h2").getConnection() | null | "SELECT 3"
|
||||
"derby" | cpDatasources.get("c3p0").get("derby").getConnection() | "APP" | "SELECT 3 FROM SYSIBM.SYSDUMMY1"
|
||||
driver | connection | username | query
|
||||
"h2:mem" | new Driver().connect(jdbcUrls.get("h2:mem"), null) | null | "SELECT 3"
|
||||
"derby:memory" | new EmbeddedDriver().connect(jdbcUrls.get("derby:memory"), null) | "APP" | "SELECT 3 FROM SYSIBM.SYSDUMMY1"
|
||||
"h2:mem" | cpDatasources.get("tomcat").get("h2:mem").getConnection() | null | "SELECT 3"
|
||||
"derby:memory" | cpDatasources.get("tomcat").get("derby:memory").getConnection() | "APP" | "SELECT 3 FROM SYSIBM.SYSDUMMY1"
|
||||
"h2:mem" | cpDatasources.get("hikari").get("h2:mem").getConnection() | null | "SELECT 3"
|
||||
"derby:memory" | cpDatasources.get("hikari").get("derby:memory").getConnection() | "APP" | "SELECT 3 FROM SYSIBM.SYSDUMMY1"
|
||||
"h2:mem" | cpDatasources.get("c3p0").get("h2:mem").getConnection() | null | "SELECT 3"
|
||||
"derby:memory" | cpDatasources.get("c3p0").get("derby:memory").getConnection() | "APP" | "SELECT 3 FROM SYSIBM.SYSDUMMY1"
|
||||
}
|
||||
|
||||
@Unroll
|
||||
|
@ -421,19 +421,19 @@ class JDBCInstrumentationTest extends AgentTestRunner {
|
|||
connection.close()
|
||||
|
||||
where:
|
||||
driver | connection | username | query
|
||||
"h2" | new Driver().connect(jdbcUrls.get("h2"), null) | null | "CREATE TABLE S_H2 (id INTEGER not NULL, PRIMARY KEY ( id ))"
|
||||
"derby" | new EmbeddedDriver().connect(jdbcUrls.get("derby"), null) | "APP" | "CREATE TABLE S_DERBY (id INTEGER not NULL, PRIMARY KEY ( id ))"
|
||||
"hsqldb" | new JDBCDriver().connect(jdbcUrls.get("hsqldb"), null) | "SA" | "CREATE TABLE PUBLIC.S_HSQLDB (id INTEGER not NULL, PRIMARY KEY ( id ))"
|
||||
"h2" | cpDatasources.get("tomcat").get("h2").getConnection() | null | "CREATE TABLE S_H2_TOMCAT (id INTEGER not NULL, PRIMARY KEY ( id ))"
|
||||
"derby" | cpDatasources.get("tomcat").get("derby").getConnection() | "APP" | "CREATE TABLE S_DERBY_TOMCAT (id INTEGER not NULL, PRIMARY KEY ( id ))"
|
||||
"hsqldb" | cpDatasources.get("tomcat").get("hsqldb").getConnection() | "SA" | "CREATE TABLE PUBLIC.S_HSQLDB_TOMCAT (id INTEGER not NULL, PRIMARY KEY ( id ))"
|
||||
"h2" | cpDatasources.get("hikari").get("h2").getConnection() | null | "CREATE TABLE S_H2_HIKARI (id INTEGER not NULL, PRIMARY KEY ( id ))"
|
||||
"derby" | cpDatasources.get("hikari").get("derby").getConnection() | "APP" | "CREATE TABLE S_DERBY_HIKARI (id INTEGER not NULL, PRIMARY KEY ( id ))"
|
||||
"hsqldb" | cpDatasources.get("hikari").get("hsqldb").getConnection() | "SA" | "CREATE TABLE PUBLIC.S_HSQLDB_HIKARI (id INTEGER not NULL, PRIMARY KEY ( id ))"
|
||||
"h2" | cpDatasources.get("c3p0").get("h2").getConnection() | null | "CREATE TABLE S_H2_C3P0 (id INTEGER not NULL, PRIMARY KEY ( id ))"
|
||||
"derby" | cpDatasources.get("c3p0").get("derby").getConnection() | "APP" | "CREATE TABLE S_DERBY_C3P0 (id INTEGER not NULL, PRIMARY KEY ( id ))"
|
||||
"hsqldb" | cpDatasources.get("c3p0").get("hsqldb").getConnection() | "SA" | "CREATE TABLE PUBLIC.S_HSQLDB_C3P0 (id INTEGER not NULL, PRIMARY KEY ( id ))"
|
||||
driver | connection | username | query
|
||||
"h2:mem" | new Driver().connect(jdbcUrls.get("h2:mem"), null) | null | "CREATE TABLE S_H2 (id INTEGER not NULL, PRIMARY KEY ( id ))"
|
||||
"derby:memory" | new EmbeddedDriver().connect(jdbcUrls.get("derby:memory"), null) | "APP" | "CREATE TABLE S_DERBY (id INTEGER not NULL, PRIMARY KEY ( id ))"
|
||||
"hsqldb:mem" | new JDBCDriver().connect(jdbcUrls.get("hsqldb:mem"), null) | "SA" | "CREATE TABLE PUBLIC.S_HSQLDB (id INTEGER not NULL, PRIMARY KEY ( id ))"
|
||||
"h2:mem" | cpDatasources.get("tomcat").get("h2:mem").getConnection() | null | "CREATE TABLE S_H2_TOMCAT (id INTEGER not NULL, PRIMARY KEY ( id ))"
|
||||
"derby:memory" | cpDatasources.get("tomcat").get("derby:memory").getConnection() | "APP" | "CREATE TABLE S_DERBY_TOMCAT (id INTEGER not NULL, PRIMARY KEY ( id ))"
|
||||
"hsqldb:mem" | cpDatasources.get("tomcat").get("hsqldb:mem").getConnection() | "SA" | "CREATE TABLE PUBLIC.S_HSQLDB_TOMCAT (id INTEGER not NULL, PRIMARY KEY ( id ))"
|
||||
"h2:mem" | cpDatasources.get("hikari").get("h2:mem").getConnection() | null | "CREATE TABLE S_H2_HIKARI (id INTEGER not NULL, PRIMARY KEY ( id ))"
|
||||
"derby:memory" | cpDatasources.get("hikari").get("derby:memory").getConnection() | "APP" | "CREATE TABLE S_DERBY_HIKARI (id INTEGER not NULL, PRIMARY KEY ( id ))"
|
||||
"hsqldb:mem" | cpDatasources.get("hikari").get("hsqldb:mem").getConnection() | "SA" | "CREATE TABLE PUBLIC.S_HSQLDB_HIKARI (id INTEGER not NULL, PRIMARY KEY ( id ))"
|
||||
"h2:mem" | cpDatasources.get("c3p0").get("h2:mem").getConnection() | null | "CREATE TABLE S_H2_C3P0 (id INTEGER not NULL, PRIMARY KEY ( id ))"
|
||||
"derby:memory" | cpDatasources.get("c3p0").get("derby:memory").getConnection() | "APP" | "CREATE TABLE S_DERBY_C3P0 (id INTEGER not NULL, PRIMARY KEY ( id ))"
|
||||
"hsqldb:mem" | cpDatasources.get("c3p0").get("hsqldb:mem").getConnection() | "SA" | "CREATE TABLE PUBLIC.S_HSQLDB_C3P0 (id INTEGER not NULL, PRIMARY KEY ( id ))"
|
||||
}
|
||||
|
||||
@Unroll
|
||||
|
@ -479,15 +479,15 @@ class JDBCInstrumentationTest extends AgentTestRunner {
|
|||
connection.close()
|
||||
|
||||
where:
|
||||
driver | connection | username | query
|
||||
"h2" | new Driver().connect(jdbcUrls.get("h2"), null) | null | "CREATE TABLE PS_H2 (id INTEGER not NULL, PRIMARY KEY ( id ))"
|
||||
"derby" | new EmbeddedDriver().connect(jdbcUrls.get("derby"), null) | "APP" | "CREATE TABLE PS_DERBY (id INTEGER not NULL, PRIMARY KEY ( id ))"
|
||||
"h2" | cpDatasources.get("tomcat").get("h2").getConnection() | null | "CREATE TABLE PS_H2_TOMCAT (id INTEGER not NULL, PRIMARY KEY ( id ))"
|
||||
"derby" | cpDatasources.get("tomcat").get("derby").getConnection() | "APP" | "CREATE TABLE PS_DERBY_TOMCAT (id INTEGER not NULL, PRIMARY KEY ( id ))"
|
||||
"h2" | cpDatasources.get("hikari").get("h2").getConnection() | null | "CREATE TABLE PS_H2_HIKARI (id INTEGER not NULL, PRIMARY KEY ( id ))"
|
||||
"derby" | cpDatasources.get("hikari").get("derby").getConnection() | "APP" | "CREATE TABLE PS_DERBY_HIKARI (id INTEGER not NULL, PRIMARY KEY ( id ))"
|
||||
"h2" | cpDatasources.get("c3p0").get("h2").getConnection() | null | "CREATE TABLE PS_H2_C3P0 (id INTEGER not NULL, PRIMARY KEY ( id ))"
|
||||
"derby" | cpDatasources.get("c3p0").get("derby").getConnection() | "APP" | "CREATE TABLE PS_DERBY_C3P0 (id INTEGER not NULL, PRIMARY KEY ( id ))"
|
||||
driver | connection | username | query
|
||||
"h2:mem" | new Driver().connect(jdbcUrls.get("h2:mem"), null) | null | "CREATE TABLE PS_H2 (id INTEGER not NULL, PRIMARY KEY ( id ))"
|
||||
"derby:memory" | new EmbeddedDriver().connect(jdbcUrls.get("derby:memory"), null) | "APP" | "CREATE TABLE PS_DERBY (id INTEGER not NULL, PRIMARY KEY ( id ))"
|
||||
"h2:mem" | cpDatasources.get("tomcat").get("h2:mem").getConnection() | null | "CREATE TABLE PS_H2_TOMCAT (id INTEGER not NULL, PRIMARY KEY ( id ))"
|
||||
"derby:memory" | cpDatasources.get("tomcat").get("derby:memory").getConnection() | "APP" | "CREATE TABLE PS_DERBY_TOMCAT (id INTEGER not NULL, PRIMARY KEY ( id ))"
|
||||
"h2:mem" | cpDatasources.get("hikari").get("h2:mem").getConnection() | null | "CREATE TABLE PS_H2_HIKARI (id INTEGER not NULL, PRIMARY KEY ( id ))"
|
||||
"derby:memory" | cpDatasources.get("hikari").get("derby:memory").getConnection() | "APP" | "CREATE TABLE PS_DERBY_HIKARI (id INTEGER not NULL, PRIMARY KEY ( id ))"
|
||||
"h2:mem" | cpDatasources.get("c3p0").get("h2:mem").getConnection() | null | "CREATE TABLE PS_H2_C3P0 (id INTEGER not NULL, PRIMARY KEY ( id ))"
|
||||
"derby:memory" | cpDatasources.get("c3p0").get("derby:memory").getConnection() | "APP" | "CREATE TABLE PS_DERBY_C3P0 (id INTEGER not NULL, PRIMARY KEY ( id ))"
|
||||
|
||||
}
|
||||
|
||||
|
@ -558,17 +558,17 @@ class JDBCInstrumentationTest extends AgentTestRunner {
|
|||
}
|
||||
|
||||
where:
|
||||
prepareStatement | driver | driverClass | url | username | query
|
||||
true | "h2" | new Driver() | "jdbc:h2:mem:" + dbName | null | "SELECT 3;"
|
||||
true | "derby" | new EmbeddedDriver() | "jdbc:derby:memory:" + dbName + ";create=true" | "APP" | "SELECT 3 FROM SYSIBM.SYSDUMMY1"
|
||||
false | "h2" | new Driver() | "jdbc:h2:mem:" + dbName | null | "SELECT 3;"
|
||||
false | "derby" | new EmbeddedDriver() | "jdbc:derby:memory:" + dbName + ";create=true" | "APP" | "SELECT 3 FROM SYSIBM.SYSDUMMY1"
|
||||
prepareStatement | driver | driverClass | url | username | query
|
||||
true | "h2:mem" | new Driver() | "jdbc:h2:mem:" + dbName | null | "SELECT 3;"
|
||||
true | "derby:memory" | new EmbeddedDriver() | "jdbc:derby:memory:" + dbName + ";create=true" | "APP" | "SELECT 3 FROM SYSIBM.SYSDUMMY1"
|
||||
false | "h2:mem" | new Driver() | "jdbc:h2:mem:" + dbName | null | "SELECT 3;"
|
||||
false | "derby:memory" | new EmbeddedDriver() | "jdbc:derby:memory:" + dbName + ";create=true" | "APP" | "SELECT 3 FROM SYSIBM.SYSDUMMY1"
|
||||
}
|
||||
|
||||
@Unroll
|
||||
def "#connectionPoolName connections should be cached in case of wrapped connections"() {
|
||||
setup:
|
||||
String dbType = "hsqldb"
|
||||
String dbType = "hsqldb:mem"
|
||||
DataSource ds = createDS(connectionPoolName, dbType, jdbcUrls.get(dbType))
|
||||
String query = "SELECT 3 FROM INFORMATION_SCHEMA.SYSTEM_USERS"
|
||||
int numQueries = 5
|
||||
|
|
Loading…
Reference in New Issue