A method comprising: receiving, at a driver component, a database command from a client application, wherein the driver component has access to a cache that includes database command entries that associate database commands with corresponding shard key expressions; determining whether the database command corresponds to any database command entry in the cache; responsive to the database command corresponding to an existing database command entry in the cache, the driver component retrieving the corresponding shard key expression from the existing database command entry; responsive to the database command not corresponding to any database command entry in the cache: requesting the corresponding shard key expression for the database command; in response to requesting the corresponding shard key expression, receiving the corresponding shard key expression for the database command; storing a new database command entry for the database command in the cache, wherein the stored new database command entry associates the database command with the corresponding shard key expression; evaluating the corresponding shard key expression to determine a shard key value, wherein the corresponding shard key expression includes at least one of a bind variable or an operator; based on the shard key value, identifying a particular shard (230A-C) of a sharded database system; and connecting to the particular shard (230A-C) for execution of the database command. receiving, at a driver component, a database command from a client application, wherein the driver component has access to a cache that includes database command entries that associate database commands with corresponding shard key expressions; determining whether the database command corresponds to any database command entry in the cache; responsive to the database command corresponding to an existing database command entry in the cache, the driver component retrieving the corresponding shard key expression from the existing database command entry; responsive to the database command not corresponding to any database command entry in the cache: requesting the corresponding shard key expression for the database command; in response to requesting the corresponding shard key expression, receiving the corresponding shard key expression for the database command; storing a new database command entry for the database command in the cache, wherein the stored new database command entry associates the database command with the corresponding shard key expression; requesting the corresponding shard key expression for the database command; in response to requesting the corresponding shard key expression, receiving the corresponding shard key expression for the database command; storing a new database command entry for the database command in the cache, wherein the stored new database command entry associates the database command with the corresponding shard key expression; evaluating the corresponding shard key expression to determine a shard key value, wherein the corresponding shard key expression includes at least one of a bind variable or an operator; based on the shard key value, identifying a particular shard (230A-C) of a sharded database system; and connecting to the particular shard (230A-C) for execution of the database command.