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



##########
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:
       mysql-connector-java version 6.0.6 doesn't have parameterTypes[0] class 
(ie. ConnectionString), and version 6.0.2 doesn't have 
com.mysql.cj.core.conf.url.HostInfo class  (ConnectionCreateNewInterceptor 
needing it), but I need those two classes  to coexist if use the target type 
directly. 




-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to