RE: Could not establish a connection to the database



Hello Bruno,

From your description, after you installed Visual Studio 2005 and SQL
Server 2005 on the machine, when creating a new ASP.NET application and use
the web admin tool to configure the ASP.NET application, you're getting the
following error, correct?

<<<<<<<<<<<<<
"Could not establish a connection to the database.
...............



Based on my experience, the problem could be caused by the following things:

1. The admin tool/ASP.NET runtime try connecting to a non-existing database
instance(according to the configured provider, membership or role manager
...)

2. The target database instance does exsits, but the current
application/'security context can not establish connection to it.

For your scenario, I noticed that you've mentioned the following installed
instances on your machine:

**My_PC_Name\Pinnacle(is this the SQL server 2005 server instance?)
**My_PC_Name\SQLEXPRESS(surely this is the SQLEXPRESS instance installed
with VS 2005)


If the above is the case, I'd like to confirm the following things with you:

1) Have you done any changes in the machine.config or your ASP.NET
application's web.config to customize any of the ASP.NET service
providers(such as membership, rolemanager ....)? Also, when using the web
admin tool, it is on which page and performing which operation did you get
the error?


2) by default in the machine.config, it contains the following default
connectionstring for all the SQL Server providers:

<connectionStrings>
<add name="LocalSqlServer" connectionString="data
source=.\SQLEXPRESS;Integrated
Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User
Instance=true" providerName="System.Data.SqlClient" />

You can check whether this is the value on your machine. And if you're
trying to use the default SQL server provider, it will use this
connectionstring to establish connection to the sqlserver instance. (if
success, it will create a aspnetdb.mdf file in your application's App_Data
sub directory).


3) If you're trying to connect to custom SQL Server database instance
instead of the default SQL express one, what custom configuration have
performed on the machine? Make sure the SQL Server instance and SQL Express
instance has been started.



In addition, for general testing, you can try the following things:

i) try creating a normal sql express mdf file in your web application's
"App_Data" folder by "Add New Item---> SQL Database" menu to see whether
you can explicitly create a sqlexpress database file

ii) are you developing the web application in VS 2005 through file sytsem
project or IIS host project? You can try both mode to see whether it
behaves differently.

iii) Here is a web article introducing how to use non-default(SQL Express)
database for ASP.NET providers, if your problem is related SQL Express, you
can use its guide to create custom provider setting against your SQL Server
2005 server instance to see whether it works.


#ASP.NET 2.0 App Service Config Issues When Not Installing Sql 2005 Express
http://aspadvice.com/blogs/plitwin/archive/2005/11/04/13590.aspx

Hope this helps. If there is anything unclear or any other information you
wonder, please feel free to let me know.


Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead



==================================================

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.



Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.

==================================================



This posting is provided "AS IS" with no warranties, and confers no rights.



.



Relevant Pages

  • Re: upgrading exchange 5.5 to 2003
    ... Microsoft Exchange Support ... > connection to the server. ... On the Connection menu, click Connect. ... >> Microsoft Exchange Support ...
    (microsoft.public.exchange2000.setup.installation)
  • Re: WAY OVER MY HEAD
    ... If you can cause a blue screen while transferring large files via both wired and wireless, that points to an issue on the server, probably hardware. ... If it's only wireless that causes this, then how about changing the wireless connection type temporarily, and see if that has any effect. ... see Help and Support Center at ... > the DNS server does not support the DNS dynamic update protocol, ...
    (microsoft.public.windows.server.sbs)
  • RE: PPTP VPN connection problems
    ... Since you want to contact your local MS support for help, ... Additional, you can establish the VPN connection from internal client, that ... | A ping to the server would result in "Request timed out". ...
    (microsoft.public.windows.server.sbs)
  • Re: accessing data mining model via web/PDA
    ... Is your OPENROWSET clause connecting to a SQL Server 2000 database? ... Is your SQL Server instance running on the same machine as your Analysis ... i need some> help for the connection string, let say to access the> mining model in the AS. ...
    (microsoft.public.sqlserver.datamining)
  • Re: VB Express SQL Express Remote Connection
    ... Yes I can connect using the SQL Server Management Studio Express Tool. ... I changed my connection to exactly what you specified and it connected. ... I can connect and create databases on the Remote Server ...
    (microsoft.public.dotnet.languages.vb)