RaigorJiang opened a new issue, #35546: URL: https://github.com/apache/shardingsphere/issues/35546
## Bug Report ### Which version of ShardingSphere did you use? 5.5.3-SNAPSHOT a0b2bf5a9598d427b2b5b8633631ddd992f40d95 ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy? ShardingSphere-Proxy ### Expected behavior Without use database, `show variables` can be executed successfully through Unicast ### Actual behavior NoSuchElementException occurs <img width="667" alt="Image" src="https://github.com/user-attachments/assets/2469319c-6c5c-427e-9354-d8f0bf9d28f5" /> - Proxy log ```plain java.util.NoSuchElementException: null at java.base/java.util.Collections$EmptyIterator.next(Collections.java:4310) at org.apache.shardingsphere.infra.session.query.QueryContext.getUsedDatabase(QueryContext.java:95) at org.apache.shardingsphere.proxy.backend.connector.StandardDatabaseConnector.<init>(StandardDatabaseConnector.java:133) at org.apache.shardingsphere.proxy.backend.connector.DatabaseConnectorFactory.newInstance(DatabaseConnectorFactory.java:52) at org.apache.shardingsphere.proxy.backend.handler.data.impl.UnicastDatabaseBackendHandler.execute(UnicastDatabaseBackendHandler.java:62) at org.apache.shardingsphere.proxy.frontend.mysql.command.query.text.query.MySQLComQueryPacketExecutor.execute(MySQLComQueryPacketExecutor.java:93) at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.doExecuteCommand(CommandExecutorTask.java:126) at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.executeCommand(CommandExecutorTask.java:121) ``` ### Reason analyze (If you can) In UnicastDatabaseBackendHandler, the current database name has been set through `connectionSession.setCurrentDatabaseName`, but `connectionContext.getCurrentDatabaseName() `is still null afterwards ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc. 1. Init any logic database with mysql storage units 2. Connect Proxy with a new client, do not use database 3. Execute `show variables` -- 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-unsubscr...@shardingsphere.apache.org.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org