CFF KB - Carrz-Fox-Fire Promotions Knowledge Base
CFF KB is all about 1 thing: The Sharing of Knowledge and the Power we gain from it.Knowledge Base
- Breadrumbs:
SQL Server error '80004005' - Cannot open database "db_name" requested by the login. The login failed. for SQL Availability Listener connection string
- Article ID:
228 - Date Created
Monday, May 18, 2020 - Last Updated
Monday, May 18, 2020 - This Article Has been Viewed
558 times - Short Desc
When connecting to SQL Server Availability Listener, you may experience the following error.
Cannot open database "db_name" requested by the login. The login failed. - Details
In this article, we are going to look at two different SQL server database connection strings used in ASP Classic. (The strings will also work in ASP.NET)
The error we were faced with this issue.Microsoft OLE DB Provider for SQL Server error '80004005'
Cannot open database "db_name" requested by the login. The login failed.
/page.asp, line 10 - Recreate Issue
Connect string to a SQL Listener will fail using the following connection string.<%
Set CFFNConn = CreateObject("ADODB.Connection")
CFFNConn.ConnectionString = "Provider=SQLOLEDB;Data Source=SQLListener,2433;Database=C2345_cs;User ID=username;Password=******;"
CFFNConn.Open
%>
The reason
The database name [C2345_cs] is the actual name of the database file. Which is what we use to connect to with a regular connection to SQL Server from our applications. - Resolve Issue
Using the following connection string will work without issue to connect to our SQL Listener.<%
Set CFFNConn = CreateObject("ADODB.Connection")
CFFNConn.ConnectionString = "Provider=SQLOLEDB;Data Source=SQLListener,2433;Database=cs;User ID=username;Password=******;"
CFFNConn.Open
%>
The reason
The database name in this connection is the actual name of the database name in SSMS (SQL Server Management Studio).
When we create a database in SSMS, we give it a name, rather long or short.
This name is what SQL Listener needs to connect to the database.
So, in the [Recreate] section above, the actual database file name is [C2345_cs]. The renaming of the database was done when I was using an outside hosting provider. And this is the name we had to use for our connection strings to work.
Using the SQL Listener, we no longer have to use the file name in our connection strings.
--------
Related Articles
Microsoft OLE DB Provider for SQL Server (0x80004005) Cannot open database«
Microsoft OLE DB Provider for SQL Server error '80004005' Cannot open database«

Share With Friends (Updated 6-8-2010)
Recent Articles
- Wi-Fi Connection to the inernet keeps dropping when connected to local network. (Not connected to ISP network) 0
- Invalid attempt to call MetaData when reader is closed. 0
- 'mycookie' is not declared. It may be inaccessible due to its protection level. 85
- Missing File or Virtual attribute 76
- Classic ASP - Out of Present Range error 92
All Topics
- Coming Soon - Knowledge Exchange
Trending Articles
- Microsoft VBScript runtime error '800a0046' Permission denied FileSystemObject 24959
- Microsoft OLE DB Provider for SQL Server error '80040e57' String or binary data would be truncated. or The field is too small to accept the amount of data you attempted to add. Try inserting or pasting less data. 21730
- ADODB.Parameters error '800a0e7c' Parameter object is improperly defined 19809
- After Effects warning: Audio conforming failed for the following file .cfa. Perhaps due to disk space 18295
- The backup set holds a backup of a database other than the existing 17094