HuLaLaGa commented on issue #32765:
URL: 
https://github.com/apache/shardingsphere/issues/32765#issuecomment-2373116024

   > * **I would say that `alibaba/druid` is weaker than I thought.** The JDBC 
Driver parsing method of `alibaba/druid` is hard-coded, which makes it 
impossible for `alibaba/druid` to use the testcontainers-java style JDBC URL. 
Based on this alone, I would never support adding integration tests for 
`alibaba/druid` in the master branch of shardingsphere, because this absolutely 
breaks the best practices defined by testcontainers-java. 🫠
   > 
   > ```shell
   > 11:28:57.213 [main] ERROR com.alibaba.druid.pool.DruidDataSource - 
{dataSource-1} init error
   > java.sql.SQLException: unknown jdbc driver : 
jdbc:tc:mysql:5.7.34://test-databases-mysql/the_database&TC_INITSCRIPT=init-schema.sql
   >    at 
com.alibaba.druid.util.JdbcUtils.getDriverClassName(JdbcUtils.java:545)
   >    at 
com.alibaba.druid.pool.DruidDataSource.resolveDriver(DruidDataSource.java:1255)
   >    at com.alibaba.druid.pool.DruidDataSource.init(DruidDataSource.java:885)
   >    at 
com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:1471)
   >    at 
com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:1463)
   >    at 
com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:83)
   >    at 
org.apache.shardingsphere.infra.datasource.pool.CatalogSwitchableDataSource.getConnection(CatalogSwitchableDataSource.java:46)
   > ```
   > 
   > * @HuLaLaGa  I made some changes to your unit test at 
[linghengqian/shardingsphere-test@9a78f43](https://github.com/linghengqian/shardingsphere-test/commit/9a78f43b83e930668817dbe9f8f4e7189855785b)
 . I can't reproduce the problem on shardingsphere 5.5.0 and druid 1.2.23 .
   > 
   > ```shell
   > sdk install java 8.0.422-tem
   > git clone [email protected]:linghengqian/shardingsphere-test.git
   > cd ./shardingsphere-test/
   > sdk use java 8.0.422-tem
   > ./mvnw -T 1C clean test 
   > ```
   > 
   > ```java
   > IntStream.range(0, 50).forEachOrdered(i -> {
   >             assertDoesNotThrow(() -> JDBC_TEMPLATE.execute("select ''"));
   >             assertDoesNotThrow(() -> JDBC_TEMPLATE.execute("insert into 
the_table(id) values(1)"));
   >         });
   > ```
   > 
   > * The unit tests execute fine.
   > 
   > ```shell
   > [INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 
14.55 s -- in com.hulalaga.ShardingSphereTest
   > [INFO] 
   > [INFO] Results:
   > [INFO] 
   > [INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
   > [INFO] 
   > [INFO] 
------------------------------------------------------------------------
   > [INFO] BUILD SUCCESS
   > [INFO] 
------------------------------------------------------------------------
   > [INFO] Total time:  16.956 s
   > [INFO] Finished at: 2024-09-25T12:06:17+08:00
   > [INFO] 
------------------------------------------------------------------------
   > ```
   > 
   > * There is a problem with your `init-schema.sql`. You are trying to 
execute `revoke all privileges, grant option from 'test'@'%';` as a non-root 
user. This obviously violates the discussion of [Access denied; you need (at 
least one of) the CREATE USER privilege(s) for this operation 
testcontainers/testcontainers-java#4545](https://github.com/testcontainers/testcontainers-java/discussions/4545).
 But I don't see you initialize the root user of mysql server.
   
   **Reproduce 'connection disabled' Exception need these steps as listed 
below**
   
   1. Use DruidConnection to execute 'Fatal Exception' SQL,such as 
AccessDenied...
   2. Reuse this DruidConnection to execute any SQL, will produce 'connection 
disabled' Exception
   
   > 'Fatal Exception' defined in Class 
com.alibaba.druid.pool.vendor.MySqlExceptionSorter


-- 
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