Installing AdventureWorksLT Sample Database

This section describes how to install AdventureWorksLT as a sample database on SQL Server.

To practice JDBC interface with SQL Server, you need some tables and data on the database server. Microsoft has a nice sample database called AdventureWorks available free for you to use. This tutorial shows you how to download and install AdventureWorks on your local SQL Server.

1. Go to the Adventure Works 2014 Sample Databases download page.

2. Download the "Adventure Works 2014 Full Database" file in C:\temp folder.

3. Download the "How to install Adventure Works 2014 Sample Databases.pdf" file. Read the "Install Adventure Works 2014 OLTP database from a backup" section.

4. Unzip "C:\temp\Adventure Works 2014 Full Database" and copy the extracted file AdventureWorks2014.bak to "C:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\Backup\AdventureWorks2014.bak"

5. Run SQLCMD command line tool to restore AdventureWorks2014 database to the local SQL Server:

C:\herong>"\Program Files\Microsoft SQL Server\Client SDK
   -S localhost\SQLEXPRESS -U sa -P HerongY@ng

1> RESTORE DATABASE AdventureWorks2014
2> FROM disk='C:\Program Files\Microsoft SQL Server\MSSQL12.SQLEXPRESS
3> WITH MOVE 'AdventureWorks2014_data' TO 'C:\Program Files\Microsoft 
   SQL Server\MSSQL12.SQLEXPRESS\MSSQL\DATA\AdventureWorks2014.mdf',
4> MOVE 'AdventureWorks2014_Log' TO 'C:\Program Files\Microsoft SQL 
6> GO

Processed 24248 pages for database 'AdventureWorks2014', file 
'AdventureWorks2014_Data' on file 1.
Processed 4 pages for database 'AdventureWorks2014', file 
'AdventureWorks2014_Log' on file 1.
RESTORE DATABASE successfully processed 24252 pages 
in 4.911 seconds (38.579 MB/sec).

When the restore process is completed, two physical database files are installed in the data directory: "C:\Program Files\Microsoft SQL Server\MSSQL12.SQLEXPRESS\MSSQL\DATA".

AdventureWorks2014.mdf  210,176 KB
AdventureWorks2014.ldf    2,048 KB

The sample database AdventureWorks2014 is ready for you to play now.

Last update: 2014.

Table of Contents

 About This Book

 JDBC (Java Database Connectivity) Introduction

 JDK (Java SE) Installation

 Installing and Running Java DB - Derby

 Derby (Java DB) JDBC Driver

 Derby (Java DB) JDBC DataSource Objects

 Java DB (Derby) - DML Statements

 Java DB (Derby) - ResultSet Objects of Queries

 Java DB (Derby) - PreparedStatement

 MySQL Installation on Windows

 MySQL JDBC Driver (MySQL Connector/J)

 MySQL - PreparedStatement

 MySQL - Reference Implementation of JdbcRowSet

 MySQL - JBDC CallableStatement

 MySQL CLOB (Character Large Object) - TEXT

 MySQL BLOB (Binary Large Object) - BLOB

 Oracle Express Edition Installation on Windows

 Oracle JDBC Drivers

 Oracle - Reference Implementation of JdbcRowSet

 Oracle - PreparedStatement

 Oracle - JBDC CallableStatement

 Oracle CLOB (Character Large Object) - TEXT

 Oracle BLOB (Binary Large Object) - BLOB

Microsoft SQL Server 2005 Express Edition

 Downloading Microsoft SQL Server 2014 Express Edition

 Installing Microsoft SQL Server 2014 Express Edition

 SQLCMD SQL Server Command Line Tool

Installing AdventureWorksLT Sample Database

 Microsoft JDBC Driver for SQL Server - sqljdbc42.jar

 Microsoft JDBC Driver - Query Statements and Result Sets

 Microsoft JDBC Driver - DatabaseMetaData Object

 Microsoft JDBC Driver - DDL Statements

 Microsoft JDBC Driver - DML Statements

 SQL Server - PreparedStatement

 SQL Server CLOB (Character Large Object) - TEXT

 SQL Server BLOB (Binary Large Object) - BLOB

 JDBC-ODBC Bridge Driver - sun.jdbc.odbc.JdbcOdbcDriver

 JDBC-ODBC Bridge Driver - Flat Text Files

 JDBC-ODBC Bridge Driver - MS Access

 JDBC-ODBC Bridge Driver - MS SQL Server

 Summary of JDBC Drivers and Database Servers

 Additional Tutorial Notes to Be Added

 Outdated Tutorials


 PDF Printing Version