Click here to Skip to main content
15,666,033 members
Articles / Database Development / SQL Server / SQL Server 2008
Posted 3 May 2011


12 bookmarked

SQL Server 2008 R2 Setup, Configurations & Remote Accessing using Java

Rate me:
Please Sign up or sign in to vote.
4.60/5 (10 votes)
3 May 2011CPOL3 min read
This article decribes SQL Server 2008 R2 setup, configurations & remote accessing using Java

Table of Contents


In this article, the configuration steps for remotely accessing SQL Server 2008 R2 using Java are described.

System Requirements

  • Operating System: Windows 7 (preferable) / Windows Server 2008 standard
  • Database System: SQL Server 2008 R2 (preferable) / SQL Server 2008
  • .NET Framework: Microsoft .NET Framework 3.5 SP1
  • Database Management Tool: SQL Server Management Studio

Configuration Steps

SQL Server 2008 R2 Installation

  1. In Instance Name page, please select the Default instance
  2. In Authentication Mode page, please select the Windows Authentication Mode

SQL Server 2008 to allow remote connections

  1. Click Start, point to All Programs, point to Microsoft SQL Server 2008 R2, point to Configuration Tools, and then click SQL Server Configuration Manager.
  2. Click SQL Server Services, make confirm SQL Server (SQLEXPRESS) and SQL Server Browser running. 
  3. If SQL Server Browser is stopped, then select its properties and point to Service tab, change the Start Mode Disabled to Automatic, click the apply button, then click start option using right mouse click over SQL Server Browser.
  4. Restart the SQL Server(SQLEXPRESS) using right mouse click over SQL Server(SQLEXPRESS).
  5. Click SQL Server Network Configuration, point to Protocols for SQLEXPRESS, point to TCP/IP, make sure TCP/IP status is Enabled.
  6. Open TCP/IP Properties form using right mouse click over TCP/IP, point to IP Address tab, point to TCP Port in Last section, change TCP Port to 1433, and click Apply button.

Create exceptions in Windows Firewall:

  1. Click Start, point to Control Panel, point to Windows Firewall Settings
  2. Click Change settings link, point to Exceptions tab
  3. Click Add port... button, do the following:
    Name: 1433
    Port number: 1433
    Protocol: TCP

Click OK, and click apply.

Alternative process to create exceptions in Windows Firewall:

  1. Click Start, point to Administrative Tools, open Windows Firewall with Advanced Security.
  2. Click Inbound Rules, Click New Rule link at the top of right section.
  3. Select Port radio button, click next.
  4. Select TCP radio button, Enter port number in Specific local ports section such as:
    Specific local ports: 1433
  5. Click next
  6. Select Allow the connection, click next button, again click next button
  7. Enter Name Ex. 1433
  8. Click Finish button

Import database using .bak extension file:

  1. In SQL Server Management Studio, Right-click the Databases folder, Click the Restore Database.
  2. Enter database name into To database section. Example: testDB
  3. Select the From device, and point the testDB.bak file location
  4. Click the OK button

To create a SQL Server login that uses SQL Server Authentication (SQL Server Management Studio):

  1. In SQL Server Management Studio, open Object Explorer and expand the folder of the server instance in which to create the new login.
  2. Right-click the Security folder, point to New, and then click Login.
  3. On the General page, enter a name for the new login in the Login name box. Example: test
  4. Select SQL Server Authentication
  5. Enter a password for the login. password example: test-1
  6. Select the Enforce password policy and Enforece password expiration options. In general, enforcing password policy is the more secure option.
  7. Confirm User must change password at next login is not selected.
  8. Select Default database as testDB.
  9. Click OK.

Add user in testDB database:

  1. In SQL Server Management Studio, open Databases folder, expand testDB
  2. Right-click the Security folder, point to New, and then click User
  3. Enter a User Name, enter login name which has been created. Example: test
  4. Select the db_datareader, db_datawriter (as you need) in Owned Schemas section
  5. Click OK

Access database using JAVA:

  1. Requirement: sqljdbc4.jar
  2. Add jar file in Java project
  3. Connection string
    String conString =jdbc:sqlserver://\\SQLEXPRESS:1433;
    databaseName=testDB;userName=test; passWord=test-2;";


  • 08 Jan, 2011: Initial version


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Written By
Software Developer (Senior) BRAC ICT
Bangladesh Bangladesh
Shaiful Islam(Palash) is dedicated, energetic, trusted, top-producing software Engineer with over 5+ years experience providing programming expertise. He is experienced in designing and developing Object Oriented solutions using Java/J2EE technology, SaaS application, SSO service, Mobile based App(Android), Travel & Courier application. He is the founder of V for Vagabond Lab. He started his career at Metafour Asia Ltd as a Software developer. Currently, He is working at BRAC ICT as senior software engineer.

Comments and Discussions

QuestionThanks Pin
bahareh8721-May-15 22:51
bahareh8721-May-15 22:51 
Questionthanks Pin
MostafaHelmy20-May-15 22:22
MostafaHelmy20-May-15 22:22 
GeneralMy vote of 5 Pin
Nidhin David28-Mar-15 20:08
Nidhin David28-Mar-15 20:08 
GeneralThanks Pin
Atif Khan19-Mar-14 0:37
Atif Khan19-Mar-14 0:37 
Questionhow to pull data remotely to remote computer to remote computer Pin
Member 1030156627-Sep-13 1:48
Member 1030156627-Sep-13 1:48 
GeneralMy vote of 5 Pin
omerelili3-Jun-12 18:12
omerelili3-Jun-12 18:12 
GeneralMy vote of 5 Pin
Nadim Saker3-May-11 23:45
Nadim Saker3-May-11 23:45 
GeneralRe: My vote of 5 Pin
Green Mile4-May-11 0:22
Green Mile4-May-11 0:22 
GeneralMy vote of 5 Pin
munnakubd3-May-11 10:57
munnakubd3-May-11 10:57 
GeneralRe: My vote of 5 Pin
Green Mile3-May-11 18:38
Green Mile3-May-11 18:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.