[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

User cannot login to database

Posted on 2005-04-17
12
Medium Priority
?
186 Views
Last Modified: 2012-06-21
Hi,

or should that be Help !

i have an application written in VB using a sql server database. This all works fine on the development machine which is running sql server 2000.

when i install the application along with the database onto a test machine running MSDE i get  an error stating ".....login failed..... " when the software tries to access the database.

any help would be very very welcome.

Thanks


Steve
0
Comment
Question by:dambuster99
  • 6
  • 5
12 Comments
 
LVL 6

Author Comment

by:dambuster99
ID: 13802507
exact error is: -

cannot open database requested in login ... login fails

thanks
0
 
LVL 28

Expert Comment

by:rafrancisco
ID: 13802826
How do you connect to the SQL Server?  Are you supplying the user name and password or are you using Windows authentication?
0
 
LVL 28

Expert Comment

by:rafrancisco
ID: 13802830
Also, make sure that the user you supplied in your connection string has access to the database specified or that the database exists.
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 3

Expert Comment

by:r_a_j_e_s_h
ID: 13803848
can u pls tell me how u r creating ur DSN

Manually or programmatically,
if u r doing manually, u come to know abt connectivity while creating the DSN itself, if programmatically u should pass the SQL user name & passward correctly with respect to DB u r trying to connect
 
0
 
LVL 6

Author Comment

by:dambuster99
ID: 13803999
Hi

the connection string is: -

If cn.State = 0 Then cn.Open "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=logicstore;Data Source=."

thanks
0
 
LVL 28

Expert Comment

by:rafrancisco
ID: 13806674
Looks like the user account used in running your application does not have access to you SQL Server database.  I suggest that instead of using Integrated Security=SSPI, try passing the user name and password so that it will be consistent across your different servers.
0
 
LVL 6

Author Comment

by:dambuster99
ID: 13807598
Thanks for the response,

ive changed the connect string to: -

If cn.State = 0 Then cn.Open "Provider=sqloledb;Data Source=(local);Initial Catalog=logicstore;User ID=sa;Password=;"

which does not seem to make any difference. -- i do think you are right but how do i set the database permissions for the user no matter whcih machine its installed on. The database will be local to the machine running MSDE but the user name shown on the msde is showing their login name.

Is it possible to allow access to the database regardless of login name ?

Thanks again
0
 
LVL 28

Expert Comment

by:rafrancisco
ID: 13808083
"Is it possible to allow access to the database regardless of login name ?"

There is a way for a user to access the database no matter which machine it is installed.  Just make the user an administrator of the machine where the database is installed.  But this is dangerous because the user will have full control of the machine and not just SQL Server.

Also, always assign a password to the 'sa' user name and never use it in connecting to your SQL Server from an application.

Lastly, based on your error message "cannot open database requested in login", it seems that there is no "logicstore" database on the SQL Server you are trying to connect to.  Were you able to verify this?

I wish I could help more.
0
 
LVL 6

Author Comment

by:dambuster99
ID: 13809805

When you say that "the database is not on the server" - what do you mean ?

The database files .ldf & .mdf both sit on the client machine -

how do i tell msde that they exist ?

sorry if this is getting basic - but im stuck...

thanks again
0
 
LVL 28

Expert Comment

by:rafrancisco
ID: 13819995
>>The database files .ldf & .mdf both sit on the client machine - how do i tell msde that they exist ? <<

You have to attach the database to MSDE.  The command to attach the database is sp_attach_db.  Here's an example on how to attach a database.

EXEC sp_attach_db @dbname = N'pubs',
   @filename1 = N'c:\Program Files\Microsoft SQL Server\MSSQL\Data\pubs.mdf',
   @filename2 = N'c:\Program Files\Microsoft SQL Server\MSSQL\Data\pubs_log.ldf'

0
 
LVL 28

Accepted Solution

by:
rafrancisco earned 2000 total points
ID: 13820005
To check if your database is in properly connected/attached to MSDE, try executing this command:

EXEC sp_databases

This will show all the existing databases in SQL Server.  Check if your database is there.
0
 
LVL 6

Author Comment

by:dambuster99
ID: 13832693
Thanks for your help and Perseverance - much appreciated.


Steve
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When trying to connect from SSMS v17.x to a SQL Server Integration Services 2016 instance or previous version, you get the error “Connecting to the Integration Services service on the computer failed with the following error: 'The specified service …
This month, Experts Exchange sat down with resident SQL expert, Jim Horn, for an in-depth look into the makings of a successful career in SQL.
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.
Suggested Courses

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question