You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by GitBox <gi...@apache.org> on 2021/09/03 03:31:05 UTC

[GitHub] [skywalking-java] lpcy commented on a change in pull request #18: fix multi-db-instance on same host port

lpcy commented on a change in pull request #18:
URL: https://github.com/apache/skywalking-java/pull/18#discussion_r701559574



##########
File path: apm-sniffer/apm-sdk-plugin/mysql-6.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jdbc/mysql/v6/ConnectionCreateOldInterceptor.java
##########
@@ -41,7 +41,12 @@ public void beforeMethod(Class clazz, Method method, Object[] allArguments, Clas
     public Object afterMethod(Class clazz, Method method, Object[] allArguments, Class<?>[] parameterTypes,
         Object ret) {
         if (ret instanceof EnhancedInstance) {
-            ConnectionInfo connectionInfo = ConnectionCache.get(allArguments[1].toString(), allArguments[2].toString());
+            String database = "";
+            try {
+                Method getDbMethod = parameterTypes[0].getDeclaredMethod("getDatabase");
+                database = (String) getDbMethod.invoke(allArguments[0]);
+            } catch (Throwable t) { }

Review comment:
       Because this plugin already exists one mysql-connector-java dependency, if I add the old version dependency and use the target type directly, I won't be able to compile it. Do you have any suggestions? 




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org