Cannot connect to SQL Server 2012 (connection string issue?) - sql-server

I have been searching through SO and found a connection string that seems to be what I need.
However, it does not work.
I use SQL Server 2012 Express and I need my application to connect (with no credentials). I am using the following con.string:
Server=(localdb)\\SQLEXPRESS;Database=MyDB;Trusted_Connection=Yes;
However, the server does not respond.

You need to either use the proper SQL Server Express - then use this connection string:
server=(local)\\SQLEXPRESS;Database=MyDB;Integrated Security=SSPI;
(use just (local) - not (localdb))
or you use LocalDB (which is a "run-on-demand" version of SQL Server Express), in that case, use:
server=(localdb)\\v11.0;Database=MyDB;Integrated Security=SSPI;
The difference:
SQL Server Express proper is a server-based solution, which is installed and runs as a Windows service all the time
SQL Server Express LocalDB is a run-on-demand version of SQL Server Express, which only gets started up when you need it (e.g. in debugging inside Visual Studio 2012/2013)

Related

Connect to your sql server without credentials

I created a project in visual studio and I want to use SQL Server Management Studio to see database. What should be the server name?
On connecting to sql server, it gives error:
I tried finding server name using cmd so the result was:
Note:
My sql server configuration manager doesn't contain any sql server services. I was using sql server 2012 so now I downloaded sql server 2017 but same, so services are shown.
How can I connect to sql server?
You will not be able to connect to the SQL server if the SQL Server service is not running. Once you have verified your service is running, you can use the option in the Server name to select your SQL Server Name.
Irfan.
You can connect to SQLServer with two ways:
Usually you run SQLServer instance as service and connect using server credentionals
Sqlexpress "embedded" style - connect to mdf/mdb-file. Behind the scenes it will start localdb service and attach db-file.
First way is recommended in most cases.
Run services.msc and look for sqlserver instances. If they are down - start one. If they are notexistent - rerun installation and check options.

Upgrading from SQL Server 2012 Express to Standard

I have a phone server running Window Server 2008. The server software is currently using Microsoft SQL Server 2012 Express Edition. I created an IVR application that has created a second database using the same SQL Server instance.
I found out post-development that the version of SQL Server installed on the server was Express and NOT Standard like I had thought. I checked the SQL Server Configuration manager and noticed that the instance is MSSQLSERVER, but it is running express. The phone system software I am using is proprietary and I cannot get in to change/modify connection strings.
My question is:
Is it reasonable to assume that upgrading from SQL Server 2012 Express to SQL Server 2012 Standard is safe? Does upgrading change the connection string, or instance name? Or is there anything I should be aware of during the upgrade? Or would it be better to just run Standard alongside Express?
Thanks!
I have read various articles saying that the connection string doesn't change, but I would like some input from someone who has actually upgraded from Express to Standard.

Excel connecting to wrong instance of SQL Server

I have SQL Server 2008 Express and SQL Server 2012 Developer Edition installed on my local machine.
The usual connection to Express looks something like this:
SERVERNAME\SQLEXPRESS
The connection to SQL Server 2012 should be this:
SERVERNAME\MSSQLSERVER,1433
The problem is that when I use the supposed connection to SQL Server 2012, Excel shows me tables that are in the Express instance.
I have ODBC connections that refer to each instance separately and successfully but for some reason this doesn't work. Could the problem be that both instances are using the same port?
Update: In case you're wondering why I was specifying the port, it's because I couldn't connect to any database with just SERVERNAME\MSSQLSERVER (but, again, using the port connected me to Express). As a test just now, I stopped all Express services and now I can connect to SQL Server 2012 using just the server name (i.e., SERVERNAME without a service name).
Still, I'm curious to know what was going on there.

Unable to login to sql server

I dont know much about sql server.
I have just re-installed windows 7 on my laptop. After that I installed Visual Studio 2012 Express Edition. I also Installed SQL Server Management Studio 2008 R2.
Now when I try to log in to sql server management studio by using server name as . or (local) or .\SQLEXPRESS or PC-Name\SQLEXPRESS and using Windows Authentication I get the error as below.
Please dont mark this question as negative as I have searched on google for last 4 hours but did not understand the problem.
Update:
There are many reasons that may cautioning the problem:
SQL Server is not running
SQL Server is not properly configured
You try to connect with a worng instance Name
You can try the following:
Go to Mycomputer->Rigt Click->Manage->Application and Services
And from there check that SQL Server Express is running
2.From there also, gCheck the Instance name of your SQL Express and be sure when you log on to Management Studio you Provide the same Instance name
Confirm that the service is installed and running. Under Computer Management, drill-down into Services and Applications -> Services.
There should be a service named "SQL Server (SQLEXPRESS)". Try a restart or start of the service.
If any other instance of SQL Server is installed it will be listed - try connecting to LOCALHOST(whatever the instance is listed as) to verify the installation is functional.
UPDATED following further information from comments:
You may have only installed the client tools (management studio), and have not installed the database service. Ensure you have the correct installer which includes the database services engine.
First check that the SQL Server parameters are set accordingly.
Go to Start -
All Programs — Microsoft SQL Server 2008 R2 — Configuration tools —
SQL Server Configuration Manager
Under SQL Server Services, make sure that the instance is running :
SQL Server ()
SQL Server Browser
Under SQL Server Network Configuration - Protocols for (), these are enabled:
TCP/IP
Named Pipes
Do the same under SQL Native Client 10.0 under Client Protocols

I can't connect to SQL Server locally

I have just installed Visual Studio 2010. It comes with SQL Server Express (if am I correct). The problem is: when I try to connect via SQL Server Management Studio Express using Servername-->BrowseForServer. There is no SQL Server Express instance just appears SERVERPC
So I can't connect this way .\SERVERPC or typing or this way .\SQLEXPRESS. I checked some protocols like TCP/IP, NamedPipes if they work properly. SQL Server is also running but I can't start SQL Server Agent and SQL Server Browser because all the buttons restart, start and stop are disabled
Start->All Programs->Sql Server _your version_->Configuration Tools->SQL Server Configuration Manager.
Go to sql server services and check if there are Sql Server at all (or is it running)

Resources