Players can connect during that time, calling the client_connect() forward before your connection to the database is made.
That is why you are getting your error.
Instead of setting a task, you can create a separate config file with the cvars and force it to execute it on plugin_init() then read the cvars values for the connection.