Cannot Connect to Database
Last Post 09/19/2010 8:17 AM by Joseph Craig. 3 Replies.
Author Messages
Al Stoughton
Nuke Newbie
Nuke Newbie
Posts:4


--
09/17/2010 10:00 AM  
I've restored my hosted site to a local instance of SQL Server, have copied down all the files, setup IIS and edited web.config.

I keep getting this error message when I try to access the site on localhost:

Installing DotNetNuke

Upgrade Error: ERROR: Could not connect to database specified in connectionString for SqlDataProvider

I'm about at my wit's end editing and changing the connections string and checking all of my SQL and IIS logins, permissions, etc.

Is there a DNN log file or some way I can get more detailed info abou this error and what I'm missing?  (I'm using SQL Server 2008 and DNN 5.x)

Thanks

Al

Joseph Craig
DNN MVP
Posts:11667


--
09/17/2010 10:10 AM  
The connection strings in your database are wrong. DotNetNuke is not able to connect to your database.

Note that there are TWO connection strings in web.config, and that both must be configured to connect to your database.

Double (TRIPLE!) check them.

When I run into trouble with connection strings, I open up SQL Server Management Studio and try to connect to the database server from the web server using the server, username and password I use in the web.config.

Joe Craig, Patapsco Research Group
Complete DNN Support
Al Stoughton
Nuke Newbie
Nuke Newbie
Posts:4


--
09/18/2010 9:46 AM  

Joe . . .

Thanks much for your reply -- you gave me the idea about trying to log into the server using the connection string credentials.  It failed which led me to a SQL Server 2008 troubleshooting session.  One of the problems (embarassingly) was that I had the Authentication Mode set to Windows only, not Mixed Mode.  Then, after fixing that, I learned that the User credentials also failed.  So, after going to mixed mode, ading a new Login and User and then fixing the Connection String, I'm in business.

Lesson learned (and I know better) - never take error messages literally.  The real, basic problem WASN'T the connections string after all.

For anyone who's interested here's a little more detailed info that led to solution.

When I attempted to connect to SQL Server using Management Studio and the uid and pw I got the message that the Login failed for that user Error 18456 State 1.  Trouble is that State 1 isn't the whole story and you have to go look at the SQL Error Log to find out that it was really State 58 (in my case).  The log told me I was in Windows Authentication only.  So I had to change the mode and then, IMPORTANTLY, stop and start the SQL Server service so the change would take effect.

After doing that, the login using my original credentials still failed but for a different reason -- that user wasn't found.  The Error Log also told me that. So I added a new Login and then aded it as a User for my DNN database, changed the credentials in the web.config connection string (2 places) and SUCCESS.  My site runs on localhost.

Thanks again for pointing me in the right direction!

Al

Joseph Craig
DNN MVP
Posts:11667


--
09/19/2010 8:17 AM  
Glad you got this worked out.

Yes, you are right when you say that there is a lot more to connecting to the database than just the connection string. 

Joe Craig, Patapsco Research Group
Complete DNN Support


---