Showing posts with label string. Show all posts
Showing posts with label string. Show all posts

Thursday, March 22, 2012

Cannot open user default database. Login failed.

Hi,

I got this application system having SQLExpress as database (ABCSystem.mdf). I'm connecting to the database thru connection string specifying database path in App.config.

At the same time, I got two paths for the mdf files. The first one is the path for my database project while the second one is the path to conduct testing. (This means that I got identical ABCSystem.mdf in two paths)

1) C:\Program Files\Company ABC\ABCDatabaseProject\

2) C:\Program Files\Company ABC Limited\ABCSystem\Database\

In my development machine, I can run my application where database path is testing path (number 2).

When I tried to copy the ABCSystem.mdf and ABCSystem_log.LDF and my application program files to another PC to test, I got the subject error message. (note that I copy program files under directory "C:\Program Files\Company ABC Limited\ABCSystem\" and mdf files under "C:\Program Files\Company ABC Limited\ABCSystem\Database\")

I try to edit path from database testing path to database project path in app.config, run the application, and notice that it is running OK.

What seems to cause the problem? Coz I need the database in the testing path which is "C:\Program Files\Company ABC Limited\ABCSystem\Database\" AND NOT "C:\Program Files\Company ABC\ABCDatabaseProject\".

Thanks alot for your kind attention.

Try this first, and then check your string accordingly:

http://msdn2.microsoft.com/en-us/library/ms345332.aspx

Buck Woody

|||I'm having this identical issue with an ODBC connection.
After wasting hours, I realized I only get the error when I try to change database name. (e.g. from a development to a production server). Based upon everything I've tried, I determined you CANNOT change server name in a Crystal report programmatically as in the Crystal sample code. It may be a possible to change servers if using a command based report (explicit SQL query), but our reports all use tables so a trial would be irrelevant.

Cannot open user default database. Login failed.

Hi,

I got this application system having SQLExpress as database (ABCSystem.mdf). I'm connecting to the database thru connection string specifying database path in App.config.

At the same time, I got two paths for the mdf files. The first one is the path for my database project while the second one is the path to conduct testing. (This means that I got identical ABCSystem.mdf in two paths)

1) C:\Program Files\Company ABC\ABCDatabaseProject\

2) C:\Program Files\Company ABC Limited\ABCSystem\Database\

In my development machine, I can run my application where database path is testing path (number 2).

When I tried to copy the ABCSystem.mdf and ABCSystem_log.LDF and my application program files to another PC to test, I got the subject error message. (note that I copy program files under directory "C:\Program Files\Company ABC Limited\ABCSystem\" and mdf files under "C:\Program Files\Company ABC Limited\ABCSystem\Database\")

I try to edit path from database testing path to database project path in app.config, run the application, and notice that it is running OK.

What seems to cause the problem? Coz I need the database in the testing path which is "C:\Program Files\Company ABC Limited\ABCSystem\Database\" AND NOT "C:\Program Files\Company ABC\ABCDatabaseProject\".

Thanks alot for your kind attention.

Try this first, and then check your string accordingly:

http://msdn2.microsoft.com/en-us/library/ms345332.aspx

Buck Woody

|||I'm having this identical issue with an ODBC connection.
After wasting hours, I realized I only get the error when I try to change database name. (e.g. from a development to a production server). Based upon everything I've tried, I determined you CANNOT change server name in a Crystal report programmatically as in the Crystal sample code. It may be a possible to change servers if using a command based report (explicit SQL query), but our reports all use tables so a trial would be irrelevant.

Tuesday, March 20, 2012

Cannot open database requested by the login.

Visual Studio
MS SQL Server
i have this connection string...
Data Source=.\SQLEXPRESS;Initial Catalog=dbName;Integrated Security=SSPI;
but an error appears on my conn.Open();
Cannot open database "dbName" requested by the login. The login failed.
Login failed for user 'SERVER\yshie'.
yshie is my username in the computer i use. just to clarify, there are two
user accounts in my pc but both of them are administrators.
Message posted via droptable.com
http://www.droptable.com/Uwe/Forums.aspx/sql-server-connectivity/200703/1
ok.. i'll start from a scratch! kindly help me build my connection string!
pls don't refer me to different websites because i can't understand those
terms(user instance... etc) so its useless for me. all i know is that i have
this visual studio 2005 and isn't it that inside there is ms sql server where
i created my database. what connection string will i use?
Message posted via droptable.com
http://www.droptable.com/Uwe/Forums.aspx/sql-server-connectivity/200703/1
|||One of the problems with the approach of "just tell me what
string to use and I don't understand the terms so don't go
into that" is that the problems you are having with the
connection string is from not understanding what those parts
of the string mean. It's like creating classes without
wanting to know what properties or methods are.
You said you are using this string:
Data Source=.\SQLEXPRESS;Initial Catalog=dbName;Integrated
Security=SSPI;
And that you get the error:
Cannot open database "dbName" requested by the login. The
login failed.
Login failed for user 'SERVER\yshie'.
The problem is that the login user (you) do not have access
to the database dbName or the database dbName does not exist
on the server. If the database you are using in your string
really is dbName then that database must exist on the server
and you must have access to it.
Just as a connection test, trying changing your Initial
Catalog to master. Keep the data source as: .\SQLEXPRESS
And keep the Integrated Security set to SSPI
-Sue
On Fri, 30 Mar 2007 04:25:14 GMT, "yshie via droptable.com"
<u32884@.uwe> wrote:

>ok.. i'll start from a scratch! kindly help me build my connection string!
>pls don't refer me to different websites because i can't understand those
>terms(user instance... etc) so its useless for me. all i know is that i have
>this visual studio 2005 and isn't it that inside there is ms sql server where
>i created my database. what connection string will i use?

Cannot open database requested by the login.

Visual Studio
MS SQL Server
i have this connection string...
Data Source=.\SQLEXPRESS;Initial Catalog=dbName;Integrated Security=SSPI;
but an error appears on my conn.Open();
Cannot open database "dbName" requested by the login. The login failed.
Login failed for user 'SERVER\yshie'.
yshie is my username in the computer i use. just to clarify, there are two
user accounts in my pc but both of them are administrators.
Message posted via droptable.com
http://www.droptable.com/Uwe/Forum...tivity/200703/1ok.. i'll start from a scratch! kindly help me build my connection string!
pls don't refer me to different websites because i can't understand those
terms(user instance... etc) so its useless for me. all i know is that i have
this visual studio 2005 and isn't it that inside there is ms sql server wher
e
i created my database. what connection string will i use?
Message posted via droptable.com
http://www.droptable.com/Uwe/Forum...tivity/200703/1|||One of the problems with the approach of "just tell me what
string to use and I don't understand the terms so don't go
into that" is that the problems you are having with the
connection string is from not understanding what those parts
of the string mean. It's like creating classes without
wanting to know what properties or methods are.
You said you are using this string:
Data Source=.\SQLEXPRESS;Initial Catalog=dbName;Integrated
Security=SSPI;
And that you get the error:
Cannot open database "dbName" requested by the login. The
login failed.
Login failed for user 'SERVER\yshie'.
The problem is that the login user (you) do not have access
to the database dbName or the database dbName does not exist
on the server. If the database you are using in your string
really is dbName then that database must exist on the server
and you must have access to it.
Just as a connection test, trying changing your Initial
Catalog to master. Keep the data source as: .\SQLEXPRESS
And keep the Integrated Security set to SSPI
-Sue
On Fri, 30 Mar 2007 04:25:14 GMT, "yshie via droptable.com"
<u32884@.uwe> wrote:

>ok.. i'll start from a scratch! kindly help me build my connection string!
>pls don't refer me to different websites because i can't understand those
>terms(user instance... etc) so its useless for me. all i know is that i hav
e
>this visual studio 2005 and isn't it that inside there is ms sql server whe
re
>i created my database. what connection string will i use?

Cannot Open Database after Publishing

Hi All,

I have developed a database application using c# and SQL Express 2005.

I have coded a connection string that works fine on the development machine but upon publishing to another machine I am getting the following error message:

Cannot open database "name of database" requested by the login. The login failed. Login Failed for user "machine name\user name".

The remote machine has SQL server express installed.

Now on the development machine the machine name and user names are different to that on the remote machine. I am using Windows Auth. The application successfully runs on the remote machine. It even updates the same database (as mentioned in the issue above) on a different form which all connection strings etc were created automatically by c#. I'm pretty new to all this and don't know where to go from here.
Any help would be greatly appritiated.

Thanks
Jon.

Hi,

The error message says that you have Windows Authentication , change it to SQL/Mix Authentication and your application will run.

Refer below links

http://support.microsoft.com/kb/555332

http://hemantgirisgoswami.blogspot.com/2006/11/change-authentication-mode-with.html

And also refer How to enable Remote Connection

blogs.msdn.com/sqlexpress/archive/2005/05/05/415084.aspx

http://support.microsoft.com/kb/914277/en-us

Hemantgiri S. Goswami

|||Thanks. I will give that a try.|||Hi Hemantgiri,

Thanks for the reply. Do I need to change this in SQL Man Studio Express or in my application?

Sorry, I'm new to this

Thanks

Jon|||

Hi,

You need to change this in your SQL Server Properties using SQL Server Management Studio.

1. Open Your SQL Server Management Studio

2. Connect / Login to Server

3. Right Click on the Server Name

4. Click on Properties

5. Select Security

6. Select the option "SQL Server and Windows Authentication Mode" under Server Authentication

7. Click Ok

Hemantgiri S. Goswami

|||Thanks

Monday, March 19, 2012

cannot open database "northwind" why

i am getting an error ... given below and my web.config is also given below

can any one help me is my connection string right ...
i am using sql server 2005 ..
my system name is soft18 ..


Server Error in '/prjLogin' Application.

Cannot open database "Northwind" requested by the login. The login failed.
Login failed for user 'SOFT18\Administrator'.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: Cannot open database "Northwind" requested by the login. The login failed.
Login failed for user 'SOFT18\Administrator'.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.


Stack Trace:

[SqlException (0x80131904): Cannot open database "Northwind" requested by the login. The login failed.
Login failed for user 'SOFT18\Administrator'.]
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +115
System.Data.SqlClient.TdsParser.ThrowExcepti....................
........................
................
...................

//web.config

<?xml version="1.0"?>
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<connectionStrings>

<add name="QuickStartSqlServer" connectionString="Server=localhost\SQLExpress;Integrated Security=SSPI;Database=Northwind;"
providerName="System.Data.SqlClient" />
</connectionStrings>

<system.web>
<authentication mode="Forms">
<forms name=".ASPXAUTH"
loginUrl="Login.aspx"
protection="All"
timeout="30"
path="/"
requireSSL="false"
slidingExpiration="true"
defaultUrl="Login.aspx"
cookieless="UseDeviceProfile"
enableCrossAppRedirects="false"/>
</authentication>

<membership defaultProvider="QuickStartMembershipSqlProvider"
userIsOnlineTimeWindow="15">
<providers>
<add
name="QuickStartMembershipSqlProvider"
type="System.Web.Security.SqlMembershipProvider, System.Web,
Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a"
connectionStringName="QuickStartSqlServer"
enablePasswordRetrieval="false"
enablePasswordReset="true"
requiresQuestionAndAnswer="true"
applicationName="LoginControls"
requiresUniqueEmail="true"
passwordFormat="Hashed"/>
</providers>
</membership>

<roleManager
enabled="true"
cacheRolesInCookie="true"
defaultProvider="QuickStartRoleManagerSqlProvider"
cookieName=".ASPXROLES"
cookiePath="/"
cookieTimeout="30"
cookieRequireSSL="false"
cookieSlidingExpiration="true"
createPersistentCookie="false"
cookieProtection="All">
<providers>
<add name="QuickStartRoleManagerSqlProvider"
type="System.Web.Security.SqlRoleProvider,
System.Web, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a"
connectionStringName="QuickStartSqlServer"
applicationName="LoginControls"/>
</providers>
</roleManager>
<authorization>
<allow users="*"/>
</authorization>
<compilation debug="true"/>
</system.web>

</configuration>You really, really, really should not do that becasue this leaves a security hole for SQL injection, imagine you user input (which should be treaten as suspious), enter in the textbox2 the following text:

'',NULL'); DROP DATABASE model; --

THis would cause the model database to be dropped, I am sure you don′t want to do this. :-) Always use parametrized queries for the access, that can′t be comnposed as easy as in the sample code of yours.

HTH, Jens Suessmeyer.

http://www.sqlserver2005.de

Sunday, March 11, 2012

Cannot move msdb/model even with -T3608

On 3 Dec, 23:04, Erland Sommarskog <esq...@.sommarskog.sewrote:
...

Quote:

Originally Posted by

This means that you did not do it right. The string you should add to
the exsting parameters are:
>
;-m;-c;-T3608
>
And when you have it right, the errorlog should read:
>
2007-12-04 00:04:36.03 Server -d D:\MSSQL\DATA\master.mdf
2007-12-04 00:04:36.05 Server -e D:\MSSQL\LOG\ERRORLOG
2007-12-04 00:04:36.05 Server -l CC:\MSSQL\LOGS\mastlog.ldf
2007-12-04 00:04:36.05 Server -m
2007-12-04 00:04:36.05 Server -c
2007-12-04 00:04:36.05 Server -T 3608
>
That is, all options should appear aligned with each other. And there
should be a space after -T.
>


Thank you for your reply.

I have done as you suggested, and now my errorlog shows the following:

2007-12-07 12:36:37.33 Server Registry startup parameters:
2007-12-07 12:36:37.33 Server -d D:\MSSQL\DATA\master.mdf
2007-12-07 12:36:37.33 Server -e D:\MSSQL\LOG\ERRORLOG
2007-12-07 12:36:37.33 Server -l C:\MSSQL\LOGS\mastlog.ldf
2007-12-07 12:36:37.33 Server -m
2007-12-07 12:36:37.33 Server -c
2007-12-07 12:36:37.33 Server -T3608

However, when I do an exec sp_detach msdb, I still get the error
message saying "System databases master, model, msdb, and tempdb
cannot be detached.".

Is there something else I need to do?

Mike.Mike (huttm@.yahoo.co.uk) writes:

Quote:

Originally Posted by

I have done as you suggested, and now my errorlog shows the following:
>
2007-12-07 12:36:37.33 Server Registry startup parameters:
2007-12-07 12:36:37.33 Server -d D:\MSSQL\DATA\master.mdf
2007-12-07 12:36:37.33 Server -e D:\MSSQL\LOG\ERRORLOG
2007-12-07 12:36:37.33 Server -l C:\MSSQL\LOGS\mastlog.ldf
2007-12-07 12:36:37.33 Server -m
2007-12-07 12:36:37.33 Server -c
2007-12-07 12:36:37.33 Server -T3608
>
However, when I do an exec sp_detach msdb, I still get the error
message saying "System databases master, model, msdb, and tempdb
cannot be detached.".
>
Is there something else I need to do?


Yes, you need to do as I told you. :-) Look at my output again:

Quote:

Originally Posted by

Quote:

Originally Posted by

>2007-12-04 00:04:36.03 Server -d D:\MSSQL\DATA\master.mdf
>2007-12-04 00:04:36.05 Server -e D:\MSSQL\LOG\ERRORLOG
>2007-12-04 00:04:36.05 Server -l CC:\MSSQL\LOGS\mastlog.ldf
>2007-12-04 00:04:36.05 Server -m
>2007-12-04 00:04:36.05 Server -c
>2007-12-04 00:04:36.05 Server -T 3608


Do you see that my hyphens are perfectly aligned, and that there is a
space after the -T? Compare to yours where the hyphens are indented
and there is no space after the -T.

Yes, the interface really sucks. I suggest that you copy the entire
startup parameters box to an editor with a fixed font, and make
sure that there are no spaces where there shouldn't be.

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx|||Erland Sommarskog (esquel@.sommarskog.se) writes:

Quote:

Originally Posted by

Yes, the interface really sucks. I suggest that you copy the entire
startup parameters box to an editor with a fixed font, and make
sure that there are no spaces where there shouldn't be.


By the way, I find the old bug that I had filed. It may help to clarify:
https://connect.microsoft.com/SQLSe...edbackID=125567
--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx

Friday, February 10, 2012

cannot find the database file specified in the connection string

can anyone help me with this error message

Server Error in '/' Application.

The SSE Provider did not find the database file specified in the connection string. At the configured trust level (below High trust level), the SSE provider can not automatically create the database file.

Description:An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details:System.Configuration.Provider.ProviderException: The SSE Provider did not find the database file specified in the connection string. At the configured trust level (below High trust level), the SSE provider can not automatically create the database file.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.


Stack Trace:

[ProviderException: The SSE Provider did not find the database file specified in the connection string. At the configured trust level (below High trust level), the SSE provider can not automatically create the database file.] System.Web.DataAccess.SqlConnectionHelper.EnsureSqlExpressDBFile(String connectionString) +2546149 System.Web.DataAccess.SqlConnectionHelper.GetConnection(String connectionString, Boolean revertImpersonation) +87 System.Web.Security.SqlMembershipProvider.GetPasswordWithFormat(String username, Boolean updateLastLoginActivityDate, Int32& status, String& password, Int32& passwordFormat, String& passwordSalt, Int32& failedPasswordAttemptCount, Int32& failedPasswordAnswerAttemptCount, Boolean& isApproved, DateTime& lastLoginDate, DateTime& lastActivityDate) +1121 System.Web.Security.SqlMembershipProvider.CheckPassword(String username, String password, Boolean updateLastLoginActivityDate, Boolean failIfNotApproved, String& salt, Int32& passwordFormat) +105 System.Web.Security.SqlMembershipProvider.CheckPassword(String username, String password, Boolean updateLastLoginActivityDate, Boolean failIfNotApproved) +42 System.Web.Security.SqlMembershipProvider.ValidateUser(String username, String password) +83 System.Web.UI.WebControls.Login.OnAuthenticate(AuthenticateEventArgs e) +160 System.Web.UI.WebControls.Login.AttemptLogin() +105 System.Web.UI.WebControls.Login.OnBubbleEvent(Object source, EventArgs e) +99 System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +35 System.Web.UI.WebControls.Button.OnCommand(CommandEventArgs e) +115 System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +163 System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5102



Version Information: Microsoft .NET Framework Version:2.0.50727.112; ASP.NET Version:2.0.50727.112

Dear,

can u post your code which you are using as a connection string? it seems that the string in Initial Catalog doesnt match any database name.

Happy Coding

|||

im fairly new to asp.net and have nevver use sql before now but i asume you mean this

<

connectionStrings>

<

addname="jamesmasonConnectionString"connectionString="Data Source=iis7sql.maximumaspbeta.com;Initial Catalog=jamesmason;Persist Security Info=True;User ID=jamesmason;Password=Rg2$&6Ne5"providerName="System.Data.SqlClient" />

</

connectionStrings>

|||Are you sure the exception came out from this connection string? No database file is specified in this connection string.?The?call?stack?shows?something?related?to?membership?provider,?so?can?you?post?membership?section?in?the?web.config??If?you?haven't?customized?membership?provider,?by?default?it?will?use?a?connectionstring?named?LocalSqlServer.?You?can?check?LocalSqlServer?connection?string to see whether any database file is specified:

Response.Write(ConfigurationManager.ConnectionStrings["LocalSqlServer"].ToString());

For more information about LocalSqlServer, you can take a look at this article:
http://weblogs.asp.net/scottgu/archive/2005/08/25/423703.aspx