Jump to content
  • Advertisement
Sign in to follow this  
Thevenin

Cannot connect to SQL Server, database in use?

This topic is 4251 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

So thus far, an IDE is turning out to be pleasant alterantive to CMD.exe, however, I cannot seem to get the database connecting. In VC#2005EE, I did this... (had it point directly to my 'Frostwinds.mdf') ... than hit ok, and got this... ... and confirmed it was MSSQL with a handle on it via process explorer... ... so, wth, why won't it share! [depressed]

Share this post


Link to post
Share on other sites
Advertisement
Do you have more than one instance of SQL Server running? If so, deattach it from both, and try to rerun the code. Actually, try that anyway.

You can detach a database using SQL Server Management Studio.

Share this post


Link to post
Share on other sites
How can I check if two instances are running? Everything thus far has led me to believe that only one instance is running. This was all just installed this morning, the only thing I've done is added the tables, columns, and some data. And this was done manually with the management tool, so its not possible for some script to have screwed up the config.

Share this post


Link to post
Share on other sites
If you don't want to attach the database, change the connection in your app to connect to SQL Server directly, instead of doing the "attach file" thing.

Share this post


Link to post
Share on other sites
Quote:
Original post by Arild Fines
If you don't want to attach the database, change the connection in your app to connect to SQL Server directly, instead of doing the "attach file" thing.


I know this is slightly tangential to the topic, but could you explain to me what the difference is?

I'm assuming that the 'attach file' method bypasses the need for a central database. If this is true, than this is no good for my needs because my needs include allowing an undefined number of people to read the database file simultaneously whilst one person able to write to the database.

What I'm currently doing is porting everything from MySQL over to SQL Server. So I'm completly unfamiliar with how SQL Server does things.

Share this post


Link to post
Share on other sites
I found a tutorial on how to establish a credential-less connection (via 'Windows Authentication') login with the SQL server, however, the performance is suddenly terrible!

This method does not use the dialogue box shown above, instead, it uses the normal connection string method...

public cMySQL()
{
string TheConnectionString = "Server=PETER\\SQLEXPRESS;Database=Frostwinds;Trusted_Connection=Yes;";
try
{
MySQLConnection = new SqlConnection(TheConnectionString);
MySQLConnection.Open();
}
catch (SqlException TheError)
{
MySQLConnection.Close();
throw new Exception("SQL Database Exception.\n" + TheError.Message);
}
}


In trying to find the bottleneck, I created a multithreaded application that connnected and read from it 1000 times on each of 1000 different threads, and this completed in under a second.

Any ideas what is going on here?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!