You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2019/08/13 09:24:51 UTC

[GitHub] [incubator-shardingsphere] fennykk opened a new issue #2863: Can I change DataSourceMetaData's pattern ?

fennykk opened a new issue #2863: Can I change DataSourceMetaData's pattern ?
URL: https://github.com/apache/incubator-shardingsphere/issues/2863
 
 
   **i have 128 databases**, if i use druid for database pool, it will create **256 threads** for these databases, but these threads are useless, maybe 2 threads is enough.
   
   so i use my company database pool called "caelus", it can change the database dynamic, and its core call like this:
   
   `String jdbcUrl = "jdbc:mysql://127.0.0.1:3306?useUnicode=true";`
   `Connection connection = DriverManager.getDriver(jdbcUrl).connect(jdbcUrl, driverProperties);`
   `connection.setCatalog("database001");`
   
   caelus use setCatalog to change the actual database 
   
   when i use druid , the connection may like this
   
   `String jdbcUrl = "jdbc:mysql://127.0.0.1:3306/database001?useUnicode=true";`
   `Connection connection = DriverManager.getDriver(jdbcUrl).connect(jdbcUrl, driverProperties);`
   
   at lastest shardingsphere version , MySQLDataSourceMetaData will check the jdbcUrl the pattern like
   
   `private final Pattern pattern = Pattern.compile("jdbc:mysql:(\\w*:)?//([\\w\\-\\.]+):?([0-9]*)/([\\w\\-]+);?\\S*", Pattern.CASE_INSENSITIVE);`
   
   so when i use the lastest version , my jdbcUrl is invalid because the metaData url is 
   
   `jdbc:mysql://127.0.0.1:3306?useUnicode=true`
   
   finally i found no way to change this pattern , so i can only use the old version 2.0.3 

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services