SQL Server refuses to connect from time to time
There are several possible issues, check one by one:


Do you have permission to access the database using the credentials that you are supplying? Maybe user don't have the necessary permissions to access the server
User credentials are ok, but user doesn't have the right to connect to the given database, you should grant him all rights needed
And last but not least, maybe there isn't a database which correspond to the information you specified, check that the database you are trying to connect exists


If everything fails, check server error logs and client event log too to get some more information.