@@ -73,23 +73,26 @@ public static void addDBInfo(
7373 }
7474 String connectionUrl = url ;
7575 Properties connectionProps = props ;
76- try {
77- DatabaseMetaData metaData = connection .getMetaData ();
78- connectionUrl = metaData .getURL ();
79- if (null != connectionUrl && !connectionUrl .equals (url )) {
80- // connection url was updated, check to see if user has also changed
81- String connectionUser = metaData .getUserName ();
82- if (null != connectionUser
83- && (null == props || !connectionUser .equalsIgnoreCase (props .getProperty ("user" )))) {
84- // merge updated user with original properties
85- connectionProps = new Properties (props );
86- connectionProps .put ("user" , connectionUser );
76+ if (null == props
77+ || !Boolean .parseBoolean (props .getProperty ("oracle.jdbc.useShardingDriverConnection" ))) {
78+ try {
79+ DatabaseMetaData metaData = connection .getMetaData ();
80+ connectionUrl = metaData .getURL ();
81+ if (null != connectionUrl && !connectionUrl .equals (url )) {
82+ // connection url was updated, check to see if user has also changed
83+ String connectionUser = metaData .getUserName ();
84+ if (null != connectionUser
85+ && (null == props || !connectionUser .equalsIgnoreCase (props .getProperty ("user" )))) {
86+ // merge updated user with original properties
87+ connectionProps = new Properties (props );
88+ connectionProps .put ("user" , connectionUser );
89+ }
90+ } else {
91+ connectionUrl = url ; // fallback in case updated url is null
8792 }
88- } else {
89- connectionUrl = url ; // fallback in case updated url is null
93+ } catch ( Throwable ignored ) {
94+ // use original values
9095 }
91- } catch (Throwable ignored ) {
92- // use original values
9396 }
9497 Connection connWithContext = connection ;
9598 if (connectionUrl .startsWith ("**internally_generated**" , connectionUrl .indexOf ("://" ) + 3 )) {
0 commit comments