SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 SQL Server Administration (2008)
 can not connect sql
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Exir
Posting Yak Master

151 Posts

Posted - 05/24/2013 :  15:23:10  Show Profile  Reply with Quote
Hi
I dont know why i can not connect to sqlserver when i use localhost as server name ?
it was ok perevios days but today it doesnt connect.
it just connect by MYCOMPUTERNAME\SQLEXPRESS

it is strange that the program which its connection string use localhost works properly but very slow

please help me

russell
Pyro-ma-ni-yak

USA
5072 Posts

Posted - 05/24/2013 :  15:32:01  Show Profile  Visit russell's Homepage  Reply with Quote
Did you modify your host file?
Go to Top of Page

James K
Flowing Fount of Yak Knowledge

3742 Posts

Posted - 05/24/2013 :  15:33:22  Show Profile  Reply with Quote
Do you mean LOCALHOST\SQLExpress? You can also try .\SqlExpress. All of those should connect. See if you are using the right parameters - http://www.connectionstrings.com/sql-server-2008
Go to Top of Page

Exir
Posting Yak Master

151 Posts

Posted - 05/24/2013 :  15:34:08  Show Profile  Reply with Quote
the program with localhost connection string doesnt work any more!
Go to Top of Page

Exir
Posting Yak Master

151 Posts

Posted - 05/24/2013 :  15:35:22  Show Profile  Reply with Quote
quote:
Originally posted by James K

Do you mean LOCALHOST\SQLExpress? You can also try .\SqlExpress. All of those should connect. See if you are using the right parameters - http://www.connectionstrings.com/sql-server-2008



no, just localhost
i was using this connection string previous days:
@"Data Source=localhost;Persist Security Info=True;Initial Catalog=project1db;User ID=ZG;Password=123456789;");
Go to Top of Page

James K
Flowing Fount of Yak Knowledge

3742 Posts

Posted - 05/24/2013 :  15:39:38  Show Profile  Reply with Quote
Usually if you just specify LOCALHOST, that goes to the default instance which is not SQLExpress.

Do this: start->run->Services.msc. Then look for SQL Server. See if there is a SQL Server(MSSQLSERVER). If there is, start it if it is not already started.

If you see other services, for example, SQL Server(SqlExpress) or SQL Server(MyNamedInstance), you should connect to those using LOCALHOST\SqlExpress and LOCALHOST\MyNamedInstance, respectively. If you have a service called SQL Server (MSSQLSERVER), you can connect to it just by using LOCALHOST as the server name.
Go to Top of Page

Exir
Posting Yak Master

151 Posts

Posted - 05/24/2013 :  15:48:25  Show Profile  Reply with Quote
In the services.msc just SQL Server(SqlExpress) was strt and when i tried to start Server(MSSQLSERVER)show this error :

Windows couldnt start the SQL Server(MSSQLSERVER)on local computer . for more information review the System event log. If this is a non-microsoft service , connect the service vendor, and refer to service-specific error code 10048
Go to Top of Page

Exir
Posting Yak Master

151 Posts

Posted - 05/24/2013 :  16:14:26  Show Profile  Reply with Quote
please help me, my database is not in my instance(LOCALHOST\SqlExpress) I made my database in localhost, how can i connect to localhost ?
Go to Top of Page

James K
Flowing Fount of Yak Knowledge

3742 Posts

Posted - 05/24/2013 :  16:23:47  Show Profile  Reply with Quote
Googling for the error code, I found this: http://primavera.zxlm.cn/kb/prim72987 Not sure if your problem is that, or something else. In any case, look in the event log to see what the description is.
Go to Top of Page

russell
Pyro-ma-ni-yak

USA
5072 Posts

Posted - 05/24/2013 :  16:29:21  Show Profile  Visit russell's Homepage  Reply with Quote
The connection string you posted is NOT to SQLEXPRESS, it is to the default instance (MSSQLSERVER).

What errors are you seeing in the event logs?
Go to Top of Page

Exir
Posting Yak Master

151 Posts

Posted - 05/25/2013 :  15:13:08  Show Profile  Reply with Quote
I started the "sql server(MSSQLSERVER)" and "sql Server Agent(MSSQLSERVER)" from sql configuration manager and then i could connect to databse using localhost
but whenever i restart the computer or turn it off, again the sql server(MSSQLSERVER) and sql Server Agent(MSSQLSERVER)go off and i should start it again to be able to use localhost.
Why it is like this ?
Go to Top of Page

russell
Pyro-ma-ni-yak

USA
5072 Posts

Posted - 05/25/2013 :  15:19:31  Show Profile  Visit russell's Homepage  Reply with Quote
Go to the services applet (start/run/services.msc/enter) and change the startup type to automatic.
Go to Top of Page

Exir
Posting Yak Master

151 Posts

Posted - 05/29/2013 :  06:49:02  Show Profile  Reply with Quote
quote:
Originally posted by russell

Go to the services applet (start/run/services.msc/enter) and change the startup type to automatic.


It is already set on automatic
Go to Top of Page

James K
Flowing Fount of Yak Knowledge

3742 Posts

Posted - 05/29/2013 :  08:13:45  Show Profile  Reply with Quote
That is strange. If you are able to start it up manually, and if the startup type is set to automatic, when the computer starts up, the service should automatically start. Look up the event log to see if there is any clue there.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.09 seconds. Powered By: Snitz Forums 2000