SQL Server 2008 Express Edition Connection Issue - sql-server

I have VS 2008 Professional Edition. After the installation (which included SQL Server 2008), I decided to install SQL Server 2008 Express Edition with Advanced Tools (so I could get SQL Server Management Studio on it). So I uninstalled the SQL Express that came with VS 2008, and installed the standalone SQL Server Express 2008 version with advanced tools.
However, When I try to logon onto SQL Server Management Studio using:
.\SQLEXPRESS
as Server name and Windows Authentication as the authentication, I get the following message:
TITLE: Connect to Server
------------------------------
Cannot connect to .\SQLEXPRESS.
------------------------------ 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: SQL Network
Interfaces, error: 26 - Error Locating
Server/Instance Specified) (Microsoft
SQL Server, Error: -1)
For help, click:
http//go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&EvtSrc=MSSQLServer&EvtID=-1&LinkId=20476
------------------------------ BUTTONS:
OK
------------------------------
Any suggestions on how to get it to work? I have tried disabling Windows Firewall as well and still no luck.
I am using WIndows Vista and SQL Server 2008 Express SP1 Patch has also been applied recently.
FIX: For those interested:
I did not have any of the Instance Based installation installed (i.e. the Database engine). I Installed the instance based stuff and it fixed it!

Start your Local SQL Server Service
Start SQL Config Manager: Click Start -> Microsoft SQL Server 2008 R2 -> SQL Server
Configuration Manager
Start SQL Services: Set the SQL Server (SQLEXPRESS) and SQL Server Browser services to automatic
start mode. Right-click each service -> Properties -> Go into the Service Tab
This will ensure they start up again if you restart your computer. Please check to ensure the state is "Running" for both services.
Login and authenticate with your Local SQL Server
Now open up SQL Server Management Studio and click "Connect to Object
Explorer" and select Server Name:
[Your PC name]\SQLEXPRESS
Example: 8540P-KL\SQLEXPRESS or (localhost)\SQLEXPRESS
To find your PC name: Right click My Computer -> Properties ->
Computer Name tab
Alternative: Login using windows authentication: Using the user name [Your
Domain]/[Your User Name]
Setup User Account
Create a new Login acct: In SQL Mgmt Studio -> Expand your local Server -> Security -> Right
click on Logins -> New Login
Set Password settings on New User Account: Uncheck Enforce password policy, password expiration and user must
change pw(Since this is local) Default database -> Your Database
Grant roles to New User Account: User Mapping Page -> Map to your db and grant db_owner role Status
Page -> Grant Permission to connect and Enable Login
Setup Access Permissions/Settings for User
Enable all auth modes: Right click your Local Server -> Properties -> Security Tab -> Enable
SQL Server and Windows Authentication Mode
Enable TCP/IP: Open SQL Server Configuration Manager -> SQL Server Network
Configuration -> Protocols for SQLEXPRESS -> Enable TCP/IP
Restart SQL Server Service: You will have to restart the SQL Server(SQLEXPRESS) after enabling TCP/IP
Database Properties File for Spring Project
database.url=jdbc:jtds:sqlserver://[local PC Computer
name];instance=SQLEXPRESS;DatabaseName=[db name];
database.username=[Your user name] database.password=[Your password]
database.driverClassName=net.sourceforge.jtds.jdbc.Driver
If you want to view larger screen shots and better formatting of the answer with more details please view the blog article below:
Setting up a Local Instance of SQL Server 2008 Blog Post:

you can look for your instance name in SQL Server Configuration Manager. It is written between brackets after SQL Server service in the services list.
the . notation is correct and it's the same as (local)

Did you try using (local)\SQLEXPRESS in the name? I've not seen that . notation before.

Scott,
I had to enable SQL Server Browser in services once I did that I was able to connect on My recent install.
after that I only had to use the computer name as the server.
edit,
while researching further on finding sql server browser, noted that reporting services, service showed its instance as .\computer name.
try that as the server name.
edit again change to backslash been playing with linux recently :)

There is a possibility that you installed as Default instance. In this case, try connecting using (local) - just (local).
Then go to Programs/Microsoft SQL Server/Configuration Tools/SQL Server Configuration Manager. Go to SQL Server Network Configuration/Protocols for MSSQLSERVER and enable Named Pipes.

Have you tried looking at the SQL Server Surface Area Configuration? You might only have SQL Authentication setup and might need to enable Network and SQL Authentication.
-JFV

I have an application that uses a connection string trough VSOT in Word 2007.
The application gave a connection error.
I allways install Sql server 2008 Express R2 in mixed mode so that i can use the build in sa with i password to connect.
I re-entered the password to be sure its correct. In a next step i opened:
‘Configuration manager’ in ‘Program files’ ‘Microsoft Sql Server 2008’ –->’ Configuration Tools’ and set all the other instances on the properties --> hide instance 'yes'
That solved the problem in my case.
Danny

If you still have problems connecting to SQL Express 2008,
read this article
http://www.linglom.com/2009/03/28/enable-remote-connection-on-sql-server-2008-express/
It tells you about configuring SQL express after installation

Related

SQL Server 2019 support in DataGrip (can't connect to an instance)

I don't seem to be able to connect to a locally installed SQL Server 2019 instance using DataGrip (2019.3).
No matter which auth I use (domain or SQL), I get the following error:
"The specified database user/password combination is rejected: [08S01] The server SQL19 is not configured to listen with TCP/IP"
URL I'm connecting to is jdbc:sqlserver://localhost\SQL19.
If instead of "SQL19" part I use SQL Server 2016 instance name, it works fine,
so I'm assuming I'm configuring the connection correctly, unless there's some tweaks I need for SQL 2019?
I can connect to a 2019 instance from SSMS and applications, it's available via TCP/IP etc.
Answering my own question with some details (#moscas answer is correct, but I feel details may still be useful for somebody).
TCP/IP seems to be disabled by default in SQL Server 2019, and SQL Configuration Manager turned out to be not easy to find: it doesn't show up when you do regular search in "Start" menu and it doesn't exist under SQL Server's folder in the menu (wtf, Microsoft?).
You need to go Computer Management (this does show up in search) -> Services and Application -> SQL Server Configuration Manager -> SQL Server Network Configuration, choose your instance and enable TCP/IP.
Datagrip starts to work then.
As far as I know, SSMS does not require TCP/IP, that's why it works. For DataGrip, you need to turn it on.
Perhaps this doc will help: https://www.jetbrains.com/help/datagrip/db-tutorial-connecting-to-ms-sql-server.html
In additional to enable TCP/IP in SQL Server Configuration Manager. I also had to enable the Sql Browser service under Sql Service Service.

Default SQL Authentication Details for SQL EXPRESS 2016

I'm attempting to remotely connect to my SQL Express 2016 server through MS SQL on my local machine however am having extreme difficulties with the authentication.. Well I assume it is an authentication issue as when I attempt connect to connect to it I receive the error message:
The remote computer refused the network connection.
When connecting through the sqlcmd I am using Windows authentication and have no issue, however to connect to it remotely I need to use SQL authentication and have no memory of creating an account so am wondering if there's a default login and password?
I believe this is the issue however it is quite likely i'm doing something stupid so any assistance would be appreciated!
You can create an account that can be used to connect to that SQLExpress instance by using SQL Server Management Studio. Expand the database you wish to create a login for in the Object Explorer. Under the Security folder, you can create a new login by right clicking the Logins folder.
Also make sure that your machine has its firewall configured to allow remote connections, the server has remote connections enabled, and that you are allowing logins for Windows Auth and SQL Server Auth.
You can allow remote connections for a server by opening the SQL Server Configuration Manager. Under the SQL Server Network Confiuration Node, Select Protocols for MYSERVERNAME. Ensure that TCP/IP is enabled.
Here's a guide on setting up the firewall: https://technet.microsoft.com/en-us/library/ms175043(v=sql.110).aspx
You can enable SQL Server Authentication by right clicking your server name in the object explorer in SQL Server Management Studio and going to the Security tab. look for the "Server Authentication" option.

VB code to connect to SQL server on windows server 2012R2 - not locally

I know how to connect to SQL server Management studio locally, the one to your desktop, Windows Authentication. Code is as below.
myconnection As New SqlConnection("data source =serverNAME01; initial catalog=ZPCD; integrated security=true")
But how do I connect to SQL server Management Studio on Windows Server 2012R2, SQL Server Authentication from my desktop ?
The computer and username for remote desktop connection to Windows Server 2012R2 are:
computerNAME01,
userNAME01
The server name, login, password and IP address to management studio (database engine) are:
Server name: serverName01
Login: sa
Password: Password01
IP: 192.167.1.21
and database name is
ZPCD
This is an example of my code, but it doesn't work.
connetionString="Data Source=192.167.1.21,1433;
Network Library=DBMSSOCN; Initial Catalog=ZPCD;
User ID=sa;Password=Password01"
Error Message:
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. (provide: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) (Microsoft SQL Server, Error: 5)
https://technet.microsoft.com/en-us/library/hh231672(v=sql.110).aspx
To enable the TCP/IP network protocol Start SQL Server Configuration
Manager. Click Start, point to All Programs, and click Microsoft SQL
Server. Click Configuration Tools, and then click SQL Server
Configuration Manager. In SQL Server Configuration Manager, in the
console pane, expand SQL Server Network Configuration. In the console
pane, click Protocols for . In the details pane,
right-click TCP/IP, and then click Enable. In the console pane, click
SQL Server Services. In the details pane, right-click SQL Server
(), and then click Restart, to stop and restart the SQL
Server service.
Remote connection string should look like so.
SqlConnection("Server=192.167.1.21\sqlinstance; DATABASE=ZPCD; Connection Timeout=5; USER ID=SA; PASSWORD=Password01")
You need to have the SQL instance, the part in the () in image below after the \ after the IP address.
Can you post this from SQL Management Studio
This is the format of the connection string I use. The format (apparently) changed in VB.NET from VS 2008 to VS 2010. When I upgraded my software from VS 2008 to VS 2010, it failed to connect to Sql Server. Took me hours to figure it out:
connectionString="server=192.168.1.1;database=MyDb;uid=sa; pwd=MyPassword" providerName="System.Data.SqlClient"
R/
Prescott ....

Remote connection to SQL server 2008 sp2

I built a window application in visual studio 2010. It is working fine at my computer.
if i have a pc that works with windows server 2008 and i install a sql server on it , how to make my application connect to database in the sql server that instaled in the server pc .
my pc connected to the server domain .
thanks
Assuming your application is already configured to use a Sql connection string, you'll just need to configure it for the Sql Server instance you're connecting to.
For example, if your database is called MyDatabase, and your windows server on your domain is called myserver.local, and you've installed Sql Express with the default SQLEXPRESS instance name, you could create your connection string (assuming ADO.NET) something like this:
Integrated Security=true;Initial Catalog=MyDatabase;Data Source=myserver.local\SQLEXPRESS
This configuration would be for Windows Authentication (Integrated Security=true): so your domain user accounts would need to be granted LOGIN rights on the server, and those Logins associated with USERS and ROLES in your database. If you wanted to use Sql Logins instead (generally requires extra configuration when setting up your Sql Server), there are different connection strings settings for specifying username and passwords. There are many options available for the connection strings as documented here: https://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlconnection.connectionstring(v=vs.110).aspx. However, with Windows Authentication the only 3 you absolutely need are the ones shown above.
You can test connectivity to your Sql Server from your PC on the network using Sql Server Management Studio, which will enable you to verify the instance name and the authentication is working as expected if you can connect to the database.

Check client connection to SQL Server 2008 Express [duplicate]

I just installed SQL Server 2008 Express on my Vista SP1 machine. I previously had 2005 on here and used it just fine with the old SQL Server Management Studio Express. I was able to connect with no problems to my PC-NAME\SQLEXPRESS instance (no, PC-NAME is not my computer name ;-).
I uninstalled 2005 and SQL Server Management Studio Express. I then installed SQL Server 2008 Express on my machine and elected to have it install SQL Server Management Studio Basic.
Now, when I try to connect to PC-NAME\SQLEXPRESS (with Windows Authentication, like I always did), I get the following message:
Cannot connect to PC-NAME\SQLEXPRESS.
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: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified) (Microsoft SQL Server, Error: -1)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&EvtSrc=MSSQLServer&EvtID=-1&LinkId=20476
When I installed SQL Server 2008, I had it use SQLEXPRESS as the local instance name. As far as I can tell, through SQL Server Configuration Manager, SQL Server is configured to allow remote connections.
When I went to the help link it mentions, the help page suggests the following:
Make sure that the SQL Server Browser service is started on the server.
Use the SQL Server Surface Area Configuration tool to enable SQL Server to accept remote connections. For more information about the SQL Server Surface Area Configuration Tool, see Surface Area Configuration for Services and Connections.
Well, as far as I can tell, there is no SQL Server Browser service on my system (looked in MMC for one, couldn't find one).
And the SQL Server Surface Area Configuration tool doesn't exist in SQL Server 2008. So good job there with your help documentation, Microsoft ;-).
I'm at a loss for what to do right now. I had a lot of work I was hoping to get done today after upgrading to 2008 (the person I'm working with got it up and running with no problem and told me it would be easy - he's also far better with database stuff that I am). Does anyone have any idea what might be wrong? I'd really appreciate it. If I can't get this working in a few hours, I'm going back to SQL Server 2005 (if that will even work, gah...).
Edit: I have tried turning Windows Firewall off, and that did not help. Also, I noticed that I do not have a "Data" directory under my SQL Server 2008 install directory tree - could I have possibly set something up wrong when I installed it?
Please check the ServerName which you provided. It should match with the below shown Name in the UserName textbox, and that name should followed with \SQLEXPRESS:
Start your Local SQL Server Service
Start SQL Config Manager: Click Start -> Microsoft SQL Server 2008 R2 -> SQL Server
Configuration Manager
Start SQL Services: Set the SQL Server (SQLEXPRESS) and SQL Server Browser services to automatic
start mode. Right-click each service -> Properties -> Go into the Service Tab
This will ensure they start up again if you restart your computer. Please check to ensure the state is "Running" for both services.
Login and authenticate with your Local SQL Server
Now open up SQL Server Management Studio and click "Connect to Object
Explorer" and select Server Name:
[Your PC name]\SQLEXPRESS
Example: 8540P-KL\SQLEXPRESS or (localhost)\SQLEXPRESS
To find your PC name: Right click My Computer -> Properties ->
Computer Name tab
Alternative: Login using windows authentication: Using the user name [Your
Domain]/[Your User Name]
Setup User Account
Create a new Login acct: In SQL Mgmt Studio -> Expand your local Server -> Security -> Right
click on Logins -> New Login
Set Password settings on New User Account: Uncheck Enforce password policy, password expiration and user must
change pw(Since this is local) Default database -> Your Database
Grant roles to New User Account: User Mapping Page -> Map to your db and grant db_owner role Status
Page -> Grant Permission to connect and Enable Login
Setup Access Permissions/Settings for User
Enable all auth modes: Right click your Local Server -> Properties -> Security Tab -> Enable
SQL Server and Windows Authentication Mode
Enable TCP/IP: Open SQL Server Configuration Manager -> SQL Server Network
Configuration -> Protocols for SQLEXPRESS -> Enable TCP/IP
Restart SQL Server Service: You will have to restart the SQL Server(SQLEXPRESS) after enabling TCP/IP
Database Properties File for Spring Project
database.url=jdbc:jtds:sqlserver://[local PC Computer
name];instance=SQLEXPRESS;DatabaseName=[db name];
database.username=[Your user name] database.password=[Your password]
database.driverClassName=net.sourceforge.jtds.jdbc.Driver
If you want to view larger screen shots and better formatting of the answer with more details please view the blog article below:
Setting up a Local Instance of SQL Server 2008 Blog Post:
I used (LocalDB)\MSSQLLocalDB as the server name, I was then able to see all the local databases.
Haha, oh boy, I figured it out. Somehow, someway, I did not install the Database Engine when I installed SQL Server 2008. I have no idea how I missed that, but that's what happened.
I know this question is old, but in case it helps anyone make sure the SQL Server Browser is running in the Services MSC. I installed SQL Server Express 2008 R2 and the SQL Server Browser Service was set to Disabled.
Start->Run->Services.msc
Find "SQL Server Browser"->Right Click->Properties
Set Startup Type to Automatic->Click Apply
Retry your connection.
I've just solved a problem related to this which may help other people.
Initially when loading up MSSMSE it had the server as PC_NAME\SQLEXPRESS and when I tried to connect it gave me Error: 26 - Error Locating Server/Instance Specified, so I went into SQL Server Configuration Manager to check if my SQL Server Browser and SQL Server services were running and set to automatic, only to find that instead of saying SQL Server (SQLEXPRESS) it says SQL Server(MSSQLSERVER).
I then tried connecting to PC-NAME\MSSQLSERVER and this time got SQL Network Interfaces, error: 25 - Connection string is not valid) (MicrosoftSQL Server, Error: 87) The parameter is incorrect so I googled this error and found that somebody had suggested that instead of using PC-NAME\MSSQLSERVER just use PC-NAME as the Server Name at the server connection interface, and this seems to work.
There's a link here http://learningsqlserver.wordpress.com/2011/01/21/what-version-of-sql-server-do-i-have/ which explains that MSSQLSERVER is the default instance and can be connected to by using just your hostname.
I think this may have arisen because I've had SQL Server 2008 installed at some point in the past.
Under Configuration Manager and Network Configuration and Protocols for your instance is TCP/IP Enabled? That could be the problem.
var.connectionstring = "server=localhost; database=dbname; integrated security=yes"
or
var.connectionstring = "server=localhost; database=dbname; login=yourlogin; pwd=yourpass"
For me, I was only able to get it to work by using "." in the server name field; was banging away for awhile trying different combos of the user name and server name. Note that during install of the server (ie this file: SQLEXPR_x64_ENU.exe) i checked default instance which defaults the name to MSSQLSERVER; the above high voted answers might be best used for separate named (ie when you need more than 1) server instances.
both of these videos helped me out:
use dot for server name: https://www.youtube.com/watch?v=DLrxFXXeLFk
general setup: https://www.youtube.com/watch?v=vng0P8Gfx2g
One of the first things that you should check is that the SQL Server (MSSQLSERVER) is started. You can go to the Services Console (services.msc) and look for SQL Server (MSSQLSERVER) to see that it is started. If not, then start the service.
You could also do this through an elevated command prompt by typing net start mssqlserver.
For me it was a windows firewall issue. Allow incoming connections. Opening port didn't work but allow programs did.
Link
Link2

Resources