News:

The Latest electronic and computer Tips that work!

Main Menu

MS-SQL server 2008 Install

Started by branx86, February 07, 2018, 11:52:55 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

branx86

If you get "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. "    You do not have the server component install or the server is not running






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:



(local)\SQLEXPRESS will work as well as .\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