Author |
Topic |
Exir
Posting Yak Master
151 Posts |
Posted - 2013-05-24 : 15:23:10
|
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\SQLEXPRESSit is strange that the program which its connection string use localhost works properly but very slowplease help me |
|
russell
Pyro-ma-ni-yak
5072 Posts |
Posted - 2013-05-24 : 15:32:01
|
Did you modify your host file? |
|
|
James K
Master Smack Fu Yak Hacker
3873 Posts |
Posted - 2013-05-24 : 15:33:22
|
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 |
|
|
Exir
Posting Yak Master
151 Posts |
Posted - 2013-05-24 : 15:34:08
|
the program with localhost connection string doesnt work any more! |
|
|
Exir
Posting Yak Master
151 Posts |
Posted - 2013-05-24 : 15:35:22
|
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 localhosti was using this connection string previous days:@"Data Source=localhost;Persist Security Info=True;Initial Catalog=project1db;User ID=ZG;Password=123456789;"); |
|
|
James K
Master Smack Fu Yak Hacker
3873 Posts |
Posted - 2013-05-24 : 15:39:38
|
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. |
|
|
Exir
Posting Yak Master
151 Posts |
Posted - 2013-05-24 : 15:48:25
|
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 |
|
|
Exir
Posting Yak Master
151 Posts |
Posted - 2013-05-24 : 16:14:26
|
please help me, my database is not in my instance(LOCALHOST\SqlExpress) I made my database in localhost, how can i connect to localhost ? |
|
|
James K
Master Smack Fu Yak Hacker
3873 Posts |
Posted - 2013-05-24 : 16:23:47
|
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. |
|
|
russell
Pyro-ma-ni-yak
5072 Posts |
Posted - 2013-05-24 : 16:29:21
|
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? |
|
|
Exir
Posting Yak Master
151 Posts |
Posted - 2013-05-25 : 15:13:08
|
I started the "sql server(MSSQLSERVER)" and "sql Server Agent(MSSQLSERVER)" from sql configuration manager and then i could connect to databse using localhostbut 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 ? |
|
|
russell
Pyro-ma-ni-yak
5072 Posts |
Posted - 2013-05-25 : 15:19:31
|
Go to the services applet (start/run/services.msc/enter) and change the startup type to automatic. |
|
|
Exir
Posting Yak Master
151 Posts |
Posted - 2013-05-29 : 06:49:02
|
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 |
|
|
James K
Master Smack Fu Yak Hacker
3873 Posts |
Posted - 2013-05-29 : 08:13:45
|
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. |
|
|
|