Home | User-Defined Functions | Tips & Tricks | SQL Server 2005 | Forums | Frequently Asked Questions | Practice Test |    
SQL Server Helper Forum
SQL Server Helper Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 SQL Server 2000/2005
 Database login failed

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkInsert Email Insert CodeInsert QuoteInsert List

* Forum Code is ON
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]


T O P I C    R E V I E W
kwan_kwan08 Posted - 08/06/2008 : 19:05:26
I try to access a same database using two different system,

a) a window based system and
b) a web based system.

Both are using VB.NET. But it seem like the there is either one of them can access the database at a time. When one of them running, the other system unable to access. The error is

"Cannot open user default database. Login failed. Login failed for user 'PY1234\Jen'."

PY1234/Jen is a window authoization.
I was using MS SQL Sever Express 2005 and the connection string are

<add name="WhyWhy.My.MySettings.BookShopConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\bin\Debug\BookShop.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True"
providerName="System.Data.SqlClient" />

As a conclusion i need the database to be connected by multiuser at the same time
Any help is appreciated.
2   L A T E S T    R E P L I E S    (Newest First)
kwan_kwan08 Posted - 08/06/2008 : 22:23:57
Thank You for your solution. I have solve the problem. i have ammend the database as folloes
<add name="WhyWhy.My.MySettings.BookShopConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\bin\Debug\BookShop.mdf;Initial Catalog=BookShop; Integrated Security=SSPI;Connect Timeout=30;User Instance=FAlse"
providerName="System.Data.SqlClient" />
The "user intances" suppose to be taken out but i don't know why there is still error when i take out the "user instance". So i just change it to false to multiuser purpose.
Beside that i also disatrached the database attach to VS and SQL Server.
sqlAdmin Posted - 08/06/2008 : 19:48:07
Based on the error message, the user PY1234\Jen does not have a default database defined in SQL Server and your connection string does not mention to which database to connect the user. Either define the default database for the PY1234\Jen user or specify to which database to connect the user when successfully connected logs in. Just add the Database property in your connection string:

<add name="WhyWhy.My.MySettings.BookShopConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\bin\Debug\BookShop.mdf;Database=YourDatabaseHere;Integrated Security=True;Connect Timeout=30;User Instance=True"
providerName="System.Data.SqlClient" />

SQL Server Helper Forum © 2006 SQL Server Helper Go To Top Of Page
Powered By: Snitz Forums 2000 Version 3.4.06