SQL server 2012 ( compact with VS11) does not connect . why
-
sábado, 05 de mayo de 2012 20:10
hi there
i have a problem with connecting to sqlserver . i have this message when i want to connectbe noticed I am using windows 8 consumer preview .
TITLE: Browse Server for Database
------------------------------
Failed to connect to server .. (Microsoft.SqlServer.ConnectionInfo)
------------------------------
ADDITIONAL INFORMATION:
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) (Microsoft SQL Server, Error: 2)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft%20SQL%20Server&EvtSrc=MSSQLServer&EvtID=2&LinkId=20476
------------------------------
The system cannot find the file specified
------------------------------
BUTTONS:
OK
------------------------------what should I do?
- Cambiado ErikEJMVP domingo, 06 de mayo de 2012 6:24 wrong forum (From:SQL Server Compact)
Todas las respuestas
-
domingo, 06 de mayo de 2012 6:58
Could not open a connection to SQL Server) (Microsoft SQL Server, Error: 2)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft%20SQL%20Server&EvtSrc=MSSQLServer&EvtID=2&LinkId=20476
------------------------------
The system cannot find the file specified
Hello,
As the message say, the (database) file can not be found, that's also the meaning of Error Code 2.
How does your connection string look like? Please check if the file really exists in the sepcified location.
Olaf Helper
* cogito ergo sum * errare humanum est * quote erat demonstrandum *
Wenn ich denke, ist das ein Fehler und das beweise ich täglich
Blog Xing -
domingo, 06 de mayo de 2012 21:11
thank you Olaf
i think you misunderstood what I meant.
my SQLserver program cannot connect to it server not the application i wrote .my problem is sqlserver. i cant even make a data base...
-
lunes, 07 de mayo de 2012 6:18Moderador
Hi Arian,
What you got is a general error, please refer to the below online article:
How to Troubleshoot Connecting to the SQL Server Database Engine
Best Regards,
Peja
Please remember to click "Mark as Answer" on the post that helps you, and to click "Unmark as Answer" if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread. -
lunes, 07 de mayo de 2012 10:20actually I tried to do these but when i go to sql server manager in sql server services i dont have any option in right hand i just see a red circle and infront of it : the remote procedure call failed
-
lunes, 07 de mayo de 2012 16:08Moderador
Hello,
Please, could you tell us which is the exact edition of your SQL Server 2012 (Express but which one,Standard,Entreprise,Developer,...)?
Please, could you explain what you mean with "Compact with VS11" ? Compact , for 90% persons on this forum , means SQL Server Compact . If it is the case , your thread is not in the good forum. Post your agreement and a moderator will move your thread to the appropriate forum ( no thread to create, no lost post...)
See this link for more explanations about SQL Server Compact :
http://www.microsoft.com/en-us/download/details.aspx?id=17876
When you have written "sql server manager", please, could you give its full name ?
Visual Studio 11 has only a beta version http://www.microsoft.com/visualstudio/11/en-us/downloads and i have not seen any SQL Server 2012 provided with Visual Studio 11
We are waiting for your feedback to try to help you more efficiently
Have a nice day
Mark Post as helpful if it provides any help.Otherwise,leave it as it is.
-
lunes, 07 de mayo de 2012 22:16
actually i mean the Sql Server which is installed with VS11 on windows 8
my problem solved by Installing a SQL server 2012 manager . ( be noticed SQL server 2008 didnt work in windows 8 and I donno why... )- Propuesto como respuesta Peja TaoModerator martes, 08 de mayo de 2012 1:49
-
martes, 08 de mayo de 2012 8:25
actually problem continues...
this is my connection string<connectionStrings> <add name="DefaultConnection" connectionString="Data Source=.;Initial Catalog=PI_DB;Integrated Security=True" providerName="System.Data.SqlClient"/> </connectionStrings>VS11 can connect to my data base and it shows the tables but asp.net manager cannot find the data base and my application cant send or get any data...
any idea?
-
martes, 08 de mayo de 2012 9:42Moderador
Hello,
Data Source = . is working only if you have done a default install ( that's to say a no-named instance )
I suppose that the name of your database is PI_DB ( Initial Catalog value )
If VS11 can connect to your database, it is because your Windows login has the permission to connect to your database ( to check : which are the permissions given to your Windows Login ? db_datareader + db_datawriter are often necessary for SELECT , UPDATE, DELETE)
For ASP.Net, it is more complex as it is often using something like ASP_Anonymous login which has no access rights to the database. But as i am not using ASP.Net, i prefer not to tell more ( i could go wrong as my last experience with ASP.Net occured 4 years ago... ).
I am surprised by your connection string on the level of the providerName. I am never using connection string in that way. I prefer to use the SqlConnectionStringBuilder class to build the connection string ( i don't trust to put a connection string in App.Config or Web.Config files , it is so easy to hack it ).
http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlconnectionstringbuilder(VS.90).aspx
You will discover "The SqlConnectionStringBuilder performs checks for valid key/value pairs. Therefore, you cannot use this class to create invalid connection strings; trying to add invalid pairs will throw an exception".Clever...
You can use the ToString() of this class to get a connection string that you will pass as parameter to the new SqlConnection. When you call this method, there is an automatic check of the validity of the connection string ( with an exception in case of an invalid value ). The use of the properties of this class is easier that to remember the complicated ( and multi names ) for each field.
An advice : use this SqlConnectionStringBuilder class to build a correct connection string when you are developing your application or when you are testing your connection string.When it will be correct and the connection + application is working , copy the connection string returned by the ToString() method and put it in your Web.Config file ( if you are using this method )
For an example of good connection string http://www.connectionstrings.com/sql-server-2008#p1
I think that the part providerName is useless or invalid ( ; instead " after True and i am not sure that System.Data.SqlClient is accepted )
Don't hesitate to post again for more help or explanations
Have a nice day
PS : In my previous post , i ask the edition of your SQL Server : no answer. I ask you what is sql server manager as i supposed it was the SQL Server Management Studio ( often shortened as SSMS ) : no answer. I ask you what you are meaning with compact with VS 11 : no answer. When someone is asking explanations, it is usually because thre is at least a good reason : it could explain why you have problems...
I hope you will answer to my explanations requests in your next post
Mark Post as helpful if it provides any help.Otherwise,leave it as it is.
- Editado Papy NormandModerator martes, 08 de mayo de 2012 9:50 PS added
-
martes, 08 de mayo de 2012 19:41
Thank you Papy Normand for you answers.
first of all please accept my apologies I thought I answered your Questions.My SQLserver was SQLserver 2012 installed with VS11 and when i wanted to to make connection it wrote compact edition . sorry if my answers wasn't clear.
and actually the connection string I wrote here generated by VS11 it self and I didnt wrote it my self.
I will try your suggestion to see if it works and I will let you know here.
thank you and sorry again. -
martes, 08 de mayo de 2012 20:52and one more thing.
how can I permit IIS to have access too DB? -
viernes, 11 de mayo de 2012 13:04
guys it isn't about connection string . its about IIS.
it seems VS11 has not the permission to have access to the database...
any idea?
-
viernes, 11 de mayo de 2012 16:49Moderador
Hello,
Please, could you tell us which is the version of IIS ( 7.0,7.5) ?
Have a nice day
Mark Post as helpful if it provides any help.Otherwise,leave it as it is.
-
viernes, 11 de mayo de 2012 20:157.5
i am using windows 8 -
viernes, 11 de mayo de 2012 21:17Moderador
Hello Arian sh,
A partial answer to your question about the support of SQL Server 2008 in Windows 8 is in this link :
http://blogs.msdn.com/b/sqlexpress/archive/2012/03/02/sql-server-express-and-windows-8.aspx
You have written in another post
"My SQLserver was SQLserver 2012 installed with VS11 and when i wanted to to make connection it wrote compact edition "
compact edition is the default choice ( i think it is because that's the 1st one in the data source provider listbox ). It can be modified by clicking on the Modify button , you will arrive to a new form which should permit to select SQL Server 2012. I have seen VS11 but at the end of 2011 and it is possible that the display has changed.
2 other links about SQL Server 2012 and IIS 7.5 , but i am not sure that they could help you ( related to LocalDB )
but they might give you some ideas to configure IIS 7.5
Have a nice day
Mark Post as helpful if it provides any help.Otherwise,leave it as it is.
-
sábado, 12 de mayo de 2012 12:02
thank you ...
but it didn't help too
why on the earth should such a thing happen?

