Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Problem with SQL Server

 
Damon Combs
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When I try to connect SQL Server I get this error: database cannot be opened
I'm hoping someone here has experience in this and knows how to make sql db fix

Any help/advice would be appreciated,

Damon
 
Ron McLeod
Saloon Keeper
Posts: 1286
143
Android Angular Framework Eclipse IDE Java Linux MySQL Database Redhat TypeScript
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How are you attempting to connect to the database - command line, Java/JDBC application, IDE such as Visual Studio, ???

Is there any more information in the error message?  If there is, can you copy the complete message here?
 
Damon Combs
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I connect  to data in a SQL Server database using the .NET Framework Data Provider for SQL Server.
 
Damon Combs
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is no info, just annoying error : Database cannot be opened
 
Devesh Sharma
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Damon,

Is the SQL Server local to your machine ?

Are you sysadmin on it (scary though) ?

If not a sysadmin, does your user exists in the Target database ?

And before all of the above, is the Database in Read/Write mode or is in Suspect state ?

You can take assistance of SQL DBA who can set you up with the necessary and sufficient privileges.
 
Knute Snortum
Sheriff
Posts: 3323
84
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch, Devesh, and thank you for your contribution.
 
Wilson Scott
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

The solution to log on is: From the Connect to Server dialog, click Options. Change value of Connect to database: to any valid database on the server. The permanent solution to fix the server is to run SQL like: ALTER LOGIN [test] WITH DEFAULT_DATABASE = master GO.  Other method to troubleshoot this is - https://www.fixtoolbox.com/sqlserverfix.html


Best Regards
 
Damon Combs
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to say thank you for taking the time to share how to go about fixing this.
 
Paul Clapham
Sheriff
Posts: 21952
36
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Damon, does that mean you've resolved the problem to your satisfaction?
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!