1 client/server database tutorial. sql server connection through ms access facbusad1 sql server ms...

45
1 Client/Server Database Tutorial

Upload: everett-baker

Post on 23-Dec-2015

229 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 1 Client/Server Database Tutorial. SQL Server Connection through MS Access FACBUSAD1 SQL server MS Access MGD B106 Computer or your own PC Remote SQL

1

Client/Server Database Tutorial

Page 2: 1 Client/Server Database Tutorial. SQL Server Connection through MS Access FACBUSAD1 SQL server MS Access MGD B106 Computer or your own PC Remote SQL

SQL Server Connection through MS Access

FACBUSAD1 SQLserver

MS Access

MGD B106 Computer or your own PC

Remote SQL server connectionThrough ODBC System DSNUser authentication using

your user name and password Export / Link

Backup accdb file on disk

Save

Your SQLDatabase created by DBA

You can create your own database

On Access

Page 3: 1 Client/Server Database Tutorial. SQL Server Connection through MS Access FACBUSAD1 SQL server MS Access MGD B106 Computer or your own PC Remote SQL

SQL Server Connection through MS Access

Empty database created by DBA on SQL server site

At client site, create ODBC System DSN for SQL server connection

Design Access database at client site Export tables from Access client to SQL

server Dynamic link Access to ODBC SQL

server database

Page 4: 1 Client/Server Database Tutorial. SQL Server Connection through MS Access FACBUSAD1 SQL server MS Access MGD B106 Computer or your own PC Remote SQL

DBA creates your database on SQL server site

FACBUSAD1 Server: (facbusad1.mcmaster.ca) Assume your email box name is johndoe and

your student ID is 0123456 Database Name in SQL Server of FACBUSAD1:

johndoe (email box name) Database Login ID: johndoe (email box name) Database Log Password: 0123456 (Student ID) Data Source Name (DSN): ODBCjohndoe

(ODBC + email box name)

Page 5: 1 Client/Server Database Tutorial. SQL Server Connection through MS Access FACBUSAD1 SQL server MS Access MGD B106 Computer or your own PC Remote SQL

Creating ODBC Connections via Windows Control Panel

Control Panel > Administrative Tools > Data Sources (ODBC)

ODBC setting is installed in the computer. When you change to another computer, you have to set it up again or copy file

Page 6: 1 Client/Server Database Tutorial. SQL Server Connection through MS Access FACBUSAD1 SQL server MS Access MGD B106 Computer or your own PC Remote SQL

Creating DSN

File DSN System DSN

Page 7: 1 Client/Server Database Tutorial. SQL Server Connection through MS Access FACBUSAD1 SQL server MS Access MGD B106 Computer or your own PC Remote SQL

Specify SQL driver

Page 8: 1 Client/Server Database Tutorial. SQL Server Connection through MS Access FACBUSAD1 SQL server MS Access MGD B106 Computer or your own PC Remote SQL

Save Data Source File Location (if File DSN)

Page 9: 1 Client/Server Database Tutorial. SQL Server Connection through MS Access FACBUSAD1 SQL server MS Access MGD B106 Computer or your own PC Remote SQL

Create DSN for SQL server connection

Page 10: 1 Client/Server Database Tutorial. SQL Server Connection through MS Access FACBUSAD1 SQL server MS Access MGD B106 Computer or your own PC Remote SQL

Specify your Login ID (your

mac email name) and password (your student ID#)

Page 11: 1 Client/Server Database Tutorial. SQL Server Connection through MS Access FACBUSAD1 SQL server MS Access MGD B106 Computer or your own PC Remote SQL

Specify TCP/IP connection tofacbusad1.mcmaster.ca

Page 12: 1 Client/Server Database Tutorial. SQL Server Connection through MS Access FACBUSAD1 SQL server MS Access MGD B106 Computer or your own PC Remote SQL

Specify default database

Page 13: 1 Client/Server Database Tutorial. SQL Server Connection through MS Access FACBUSAD1 SQL server MS Access MGD B106 Computer or your own PC Remote SQL

Perform translation for character data

Page 14: 1 Client/Server Database Tutorial. SQL Server Connection through MS Access FACBUSAD1 SQL server MS Access MGD B106 Computer or your own PC Remote SQL

Finish DSN

File DSN System DSN

Page 15: 1 Client/Server Database Tutorial. SQL Server Connection through MS Access FACBUSAD1 SQL server MS Access MGD B106 Computer or your own PC Remote SQL

Export and Link ODBC Create a access database Export it to your SQL server Link SQL server database to your

Access db Manipulate SQL server database

from Access db

Page 16: 1 Client/Server Database Tutorial. SQL Server Connection through MS Access FACBUSAD1 SQL server MS Access MGD B106 Computer or your own PC Remote SQL

SQL Server Upsizing Access 2007 has feature called

SQL Server Upsizing Wizard Allows exporting and linking of all

tables to SQL Server Allows triggers to keep

autonumber fields functioning, and maintains relationships between tables

Page 17: 1 Client/Server Database Tutorial. SQL Server Connection through MS Access FACBUSAD1 SQL server MS Access MGD B106 Computer or your own PC Remote SQL

Export Access table to SQL server

Page 18: 1 Client/Server Database Tutorial. SQL Server Connection through MS Access FACBUSAD1 SQL server MS Access MGD B106 Computer or your own PC Remote SQL

Select ODBC Data Source

File DSN System DSN

Save your File DSN in your Q drive so you can use it anywhere

Page 19: 1 Client/Server Database Tutorial. SQL Server Connection through MS Access FACBUSAD1 SQL server MS Access MGD B106 Computer or your own PC Remote SQL

Login SQL server using your mac email name and your student ID #

Page 20: 1 Client/Server Database Tutorial. SQL Server Connection through MS Access FACBUSAD1 SQL server MS Access MGD B106 Computer or your own PC Remote SQL

Select Tables and Settings for Export

Page 21: 1 Client/Server Database Tutorial. SQL Server Connection through MS Access FACBUSAD1 SQL server MS Access MGD B106 Computer or your own PC Remote SQL

Link Tables

Page 22: 1 Client/Server Database Tutorial. SQL Server Connection through MS Access FACBUSAD1 SQL server MS Access MGD B106 Computer or your own PC Remote SQL

Complete ODBC Link

Page 23: 1 Client/Server Database Tutorial. SQL Server Connection through MS Access FACBUSAD1 SQL server MS Access MGD B106 Computer or your own PC Remote SQL

Other ways to Create SQL Tables

• Export a table to ODBC Database• Export all tables to ODBC Database

•Both have same import method

Page 24: 1 Client/Server Database Tutorial. SQL Server Connection through MS Access FACBUSAD1 SQL server MS Access MGD B106 Computer or your own PC Remote SQL

Export Access 2007 Tables

Page 25: 1 Client/Server Database Tutorial. SQL Server Connection through MS Access FACBUSAD1 SQL server MS Access MGD B106 Computer or your own PC Remote SQL

Select Table Name

Page 26: 1 Client/Server Database Tutorial. SQL Server Connection through MS Access FACBUSAD1 SQL server MS Access MGD B106 Computer or your own PC Remote SQL

Other ways to Link SQL Tables

• Open ODBC Database instead of Access db• Import ODBC Database

•Both have same import method

Page 27: 1 Client/Server Database Tutorial. SQL Server Connection through MS Access FACBUSAD1 SQL server MS Access MGD B106 Computer or your own PC Remote SQL

Open ODBC Database

Page 28: 1 Client/Server Database Tutorial. SQL Server Connection through MS Access FACBUSAD1 SQL server MS Access MGD B106 Computer or your own PC Remote SQL

Import ODBC Data Source

Page 29: 1 Client/Server Database Tutorial. SQL Server Connection through MS Access FACBUSAD1 SQL server MS Access MGD B106 Computer or your own PC Remote SQL

Select Link Tables

Page 30: 1 Client/Server Database Tutorial. SQL Server Connection through MS Access FACBUSAD1 SQL server MS Access MGD B106 Computer or your own PC Remote SQL

Specify keys

Page 31: 1 Client/Server Database Tutorial. SQL Server Connection through MS Access FACBUSAD1 SQL server MS Access MGD B106 Computer or your own PC Remote SQL

Complete ODBC Link

Page 32: 1 Client/Server Database Tutorial. SQL Server Connection through MS Access FACBUSAD1 SQL server MS Access MGD B106 Computer or your own PC Remote SQL

Managing database on SQL server

Using linked tables you can update data stored on SQL server using MicroSoft Access

You can also design and run forms and reports on Access

However, you cannot drop tables on SQL server through Access

Page 33: 1 Client/Server Database Tutorial. SQL Server Connection through MS Access FACBUSAD1 SQL server MS Access MGD B106 Computer or your own PC Remote SQL

http://facbusad1.mcmaster.ca/users/ap1/yuanyuf/drop_table.asp

Page 34: 1 Client/Server Database Tutorial. SQL Server Connection through MS Access FACBUSAD1 SQL server MS Access MGD B106 Computer or your own PC Remote SQL

MicroSoft SQL Server SQL Server registration

local and remote servers SQL Server security control

Windows NT authenticationSQL user authentication

Restore and Backup Import and export

Page 35: 1 Client/Server Database Tutorial. SQL Server Connection through MS Access FACBUSAD1 SQL server MS Access MGD B106 Computer or your own PC Remote SQL

SQL Client/Server Connection

FACBUSAD1 SQLserver

Local SQL server

MGD B106 Computer or your own PC

Remote SQL server registration

User authentication using

your user name and password

Local SQL server registration

Import/export

Backup disk

Backup/restore

Yourdatabase created by DBA

You create your own

database

Page 36: 1 Client/Server Database Tutorial. SQL Server Connection through MS Access FACBUSAD1 SQL server MS Access MGD B106 Computer or your own PC Remote SQL

SQL server registration

Page 37: 1 Client/Server Database Tutorial. SQL Server Connection through MS Access FACBUSAD1 SQL server MS Access MGD B106 Computer or your own PC Remote SQL

Find your database on server

Page 38: 1 Client/Server Database Tutorial. SQL Server Connection through MS Access FACBUSAD1 SQL server MS Access MGD B106 Computer or your own PC Remote SQL

Import and Backup

Page 39: 1 Client/Server Database Tutorial. SQL Server Connection through MS Access FACBUSAD1 SQL server MS Access MGD B106 Computer or your own PC Remote SQL

Restore database

Page 40: 1 Client/Server Database Tutorial. SQL Server Connection through MS Access FACBUSAD1 SQL server MS Access MGD B106 Computer or your own PC Remote SQL

Restore database from backup disk

Page 41: 1 Client/Server Database Tutorial. SQL Server Connection through MS Access FACBUSAD1 SQL server MS Access MGD B106 Computer or your own PC Remote SQL

Specify source

Page 42: 1 Client/Server Database Tutorial. SQL Server Connection through MS Access FACBUSAD1 SQL server MS Access MGD B106 Computer or your own PC Remote SQL

Specify destination

Page 43: 1 Client/Server Database Tutorial. SQL Server Connection through MS Access FACBUSAD1 SQL server MS Access MGD B106 Computer or your own PC Remote SQL

Transfer

Page 44: 1 Client/Server Database Tutorial. SQL Server Connection through MS Access FACBUSAD1 SQL server MS Access MGD B106 Computer or your own PC Remote SQL

Check table definition

Page 45: 1 Client/Server Database Tutorial. SQL Server Connection through MS Access FACBUSAD1 SQL server MS Access MGD B106 Computer or your own PC Remote SQL

Suggested Flower Store Tables for Assignment 3

Customers (Customer_Name, Password, Address, Phone_Number)

Products (Product_Code, Product_Name, Unit_Price)

Orders (Order_Number, Customer_Name, Order_Date, Recipient_Name, Recipient_Address, Creadit_Type, Creadit_No, Expire_Date )

Orderln (Order_Number, Product_Code, Quantity)

Usage (Product_Code, Occasion)