SlideShare a Scribd company logo
1 of 26
Connecting to Microsoft SQL 
Server 
Presented By 
K1/ 4, Second floor, Sector-15/ 16 Market, 
Vashi, Navi Mumbai. 
Contact : 9892900103 / 9892900173 
wwwwww..vviibbrraanntttteecchhnnoollooggiieess..ccoo..iinn
Introduction 
 We are going to discuss establishing an 
connection to a SQL Server Database. 
 You will learn that there is an easy way and a 
hard way.
Agenda 
 Overview – What do you have to know… 
 Security Modes 
 Database Interfaces 
 Connecting to a SQL Server Data Source
Overview – What do you have to know… 
1. Server Name 
2. Security Information 
3. Database name 
4. Data Interface / API to use 
5. Steps to connect…
Security Modes 
There are two types of modes: 
 Standard Mode (default) 
 Integrated Mode 
CLIENT SQL SERVER 
Standard and 
Integrated Security 
DATABASE 
Database Security 
Users, Groups, 
Permissions
Database Interfaces 
OLE DB DB-ODBC 
Library 
Data 
Object 
Interfaces 
Application 
Programming 
Interfaces 
ADO RDO VBSQL DAO 
JET 
Relational 
Databases 
Other Data 
Sources
Connecting to a SQL Server Data Source 
 Connecting with Data Control 
 Connecting with ADO Data Control (ADO) 
 Connecting with ADO Data Control (DSN) 
 Connecting with ADO Data Control (UDL) 
 Connecting with ADO (Programmatically)
Connecting with Data Control 
 Natively it can’t be done… 
 It uses DAO. 
 However… 
 If a Jet Database has already connected to a SQL 
Server database, then we can connect to that. 
 Downside 
 We’re indirectly connecting (through JET) 
 Probably not the most efficient way. 
 DEMO
Connecting with ADO Data Control 
(ADO) 
 Natively it connects fine 
 It’s ADO 
 Set the Connection string property 
 Set the RecordSource property 
 DEMO
Connecting with ADO Data Control 
(DSN) 
 Natively it connects fine 
 It’s ODBC 
 Set the Connection string property 
 Set the RecordSource property
Data Source Name (DSN) 
A DSN is a registry entry (Machine DSN) or text file 
(File DSN) that contains information about a database 
and the SQL Server it resides on. 
Control Panel -> 
Administrative Tools -> Data 
Sources (ODBC) 
Start Menu -> Administrative 
Tools -> Data Sources 
(ODBC)
Demo – Setting up a Data Source Name
Example of a File DSN (Standard) 
[ODBC] 
DRIVER=SQL Server 
UID=sa 
DATABASE=StateU 
WSID=DALGOODWIN3 
APP=Microsoft® Access 
SERVER=dalgoodwin3
Example of a File DSN (Integrated) 
[ODBC] 
DRIVER=SQL Server 
UID=tgoodwin 
Trusted_Connection=Yes 
DATABASE=pubs 
WSID=DALGOODWIN3 
APP=Microsoft Open Database Connectivity 
SERVER=DALGOODWIN3DALGOODWIN32000
DEMO – ADO Control with DSN
Connecting with ADO Data Control 
(UDL) 
 Natively it connects fine 
 It’s ADO 
 Set the Connection string property 
 Set the RecordSource property
Creating a UDL 
 Create a file with a .UDL extention. 
 Double-click on the icon.
Set the Provider
Set the Connection and Test
Examine the UDL 
[oledb] 
; Everything after this line is an OLE DB initstring 
Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist 
Security Info=False;User ID=sa;Initial Catalog=pubs;Data 
Source=dalgoodwin3dalgoodwin32000 
Look familiar? 
Can you say “Connection string”
DEMO – ADO Control with UDL
Connecting with ADO (Programmatically) 
 Declare an ADO connection object 
 Set the Connection String 
 Open the Connection 
 Instantiate the recordset etc….
DEMO – Connect with ADO
Other ways 
 RDO – Similar to ADO. Use DSN or DSN-less 
connection strings 
 ODBCDirect – Too much for this lesson 
 ODBC – lots of API calls. Better off with the 
ADO abstraction.
Summary 
 We discussed establishing an connection to a 
SQL Server Database. 
 We learned that there is an easy way and a 
hard way 
 Questions?

More Related Content

What's hot

Learn PHP Lacture2
Learn PHP Lacture2Learn PHP Lacture2
Learn PHP Lacture2
ADARSH BHATT
 
ADO.NET -database connection
ADO.NET -database connectionADO.NET -database connection
ADO.NET -database connection
Anekwong Yoddumnern
 
Introduction to SQLite in Adobe AIR 1.5
Introduction to SQLite in Adobe AIR 1.5Introduction to SQLite in Adobe AIR 1.5
Introduction to SQLite in Adobe AIR 1.5
Peter Elst
 

What's hot (20)

Dealing with SQL Security from ADO.NET
Dealing with SQL Security from ADO.NETDealing with SQL Security from ADO.NET
Dealing with SQL Security from ADO.NET
 
ASP.NET 09 - ADO.NET
ASP.NET 09 - ADO.NETASP.NET 09 - ADO.NET
ASP.NET 09 - ADO.NET
 
Learn PHP Lacture2
Learn PHP Lacture2Learn PHP Lacture2
Learn PHP Lacture2
 
Ext GWT 3.0 Data Widgets
Ext GWT 3.0 Data WidgetsExt GWT 3.0 Data Widgets
Ext GWT 3.0 Data Widgets
 
ADO.NET -database connection
ADO.NET -database connectionADO.NET -database connection
ADO.NET -database connection
 
Ado.Net
Ado.NetAdo.Net
Ado.Net
 
Ado.net
Ado.netAdo.net
Ado.net
 
Accessing data with android cursors
Accessing data with android cursorsAccessing data with android cursors
Accessing data with android cursors
 
Chapter 3: ado.net
Chapter 3: ado.netChapter 3: ado.net
Chapter 3: ado.net
 
Ado.Net Architecture
Ado.Net ArchitectureAdo.Net Architecture
Ado.Net Architecture
 
Mdst 3559-03-01-sql-php
Mdst 3559-03-01-sql-phpMdst 3559-03-01-sql-php
Mdst 3559-03-01-sql-php
 
Ado.net
Ado.netAdo.net
Ado.net
 
Simple Data Binding
Simple Data BindingSimple Data Binding
Simple Data Binding
 
Jdbc 1
Jdbc 1Jdbc 1
Jdbc 1
 
Ado .net
Ado .netAdo .net
Ado .net
 
Green dao 3.0
Green dao 3.0Green dao 3.0
Green dao 3.0
 
ODI User and Security
ODI User and Security ODI User and Security
ODI User and Security
 
Introduction to SQLite in Adobe AIR 1.5
Introduction to SQLite in Adobe AIR 1.5Introduction to SQLite in Adobe AIR 1.5
Introduction to SQLite in Adobe AIR 1.5
 
Database Basics and MySQL
Database Basics and MySQLDatabase Basics and MySQL
Database Basics and MySQL
 
12 SQL
12 SQL12 SQL
12 SQL
 

Viewers also liked

OPAH en vallée d'Aure et du Louron
OPAH en vallée d'Aure et du LouronOPAH en vallée d'Aure et du Louron
OPAH en vallée d'Aure et du Louron
Philippe Villette
 
Adopt a tree
Adopt a treeAdopt a tree
Adopt a tree
vicky Amr
 
大陸風景
大陸風景大陸風景
大陸風景
honan4108
 
Apartes de la Conferencia de la SJG del 14 y 21 de Enero de 2012:Luminosity f...
Apartes de la Conferencia de la SJG del 14 y 21 de Enero de 2012:Luminosity f...Apartes de la Conferencia de la SJG del 14 y 21 de Enero de 2012:Luminosity f...
Apartes de la Conferencia de la SJG del 14 y 21 de Enero de 2012:Luminosity f...
SOCIEDAD JULIO GARAVITO
 
Animation du 27 septembre au 12 octobre 2014 (1)
Animation du 27 septembre au 12 octobre 2014 (1)Animation du 27 septembre au 12 octobre 2014 (1)
Animation du 27 septembre au 12 octobre 2014 (1)
Philippe Villette
 
Celtic holidays in the usa
Celtic holidays in the usaCeltic holidays in the usa
Celtic holidays in the usa
Sarah
 
I16 Intelligent Keypad
I16 Intelligent Keypad I16 Intelligent Keypad
I16 Intelligent Keypad
Photonjohn
 

Viewers also liked (16)

OPAH en vallée d'Aure et du Louron
OPAH en vallée d'Aure et du LouronOPAH en vallée d'Aure et du Louron
OPAH en vallée d'Aure et du Louron
 
Como corregir tu estilo guías
Como corregir tu estilo  guíasComo corregir tu estilo  guías
Como corregir tu estilo guías
 
Digital toolbox for_science_assessment
Digital toolbox for_science_assessmentDigital toolbox for_science_assessment
Digital toolbox for_science_assessment
 
Adopt a tree
Adopt a treeAdopt a tree
Adopt a tree
 
Arriba en llamas 01
Arriba en llamas 01Arriba en llamas 01
Arriba en llamas 01
 
大陸風景
大陸風景大陸風景
大陸風景
 
Silabus pgsd 2011
Silabus pgsd 2011Silabus pgsd 2011
Silabus pgsd 2011
 
Apartes de la Conferencia de la SJG del 14 y 21 de Enero de 2012:Luminosity f...
Apartes de la Conferencia de la SJG del 14 y 21 de Enero de 2012:Luminosity f...Apartes de la Conferencia de la SJG del 14 y 21 de Enero de 2012:Luminosity f...
Apartes de la Conferencia de la SJG del 14 y 21 de Enero de 2012:Luminosity f...
 
Unit 4
Unit 4Unit 4
Unit 4
 
Life Begins at 40: 6 lessons we shouldn't forget from our 40 years of gaming ...
Life Begins at 40: 6 lessons we shouldn't forget from our 40 years of gaming ...Life Begins at 40: 6 lessons we shouldn't forget from our 40 years of gaming ...
Life Begins at 40: 6 lessons we shouldn't forget from our 40 years of gaming ...
 
Superheroes SXSW 2013
Superheroes SXSW 2013Superheroes SXSW 2013
Superheroes SXSW 2013
 
Animation du 27 septembre au 12 octobre 2014 (1)
Animation du 27 septembre au 12 octobre 2014 (1)Animation du 27 septembre au 12 octobre 2014 (1)
Animation du 27 septembre au 12 octobre 2014 (1)
 
Diodos
DiodosDiodos
Diodos
 
2010-03-31 - VU Amsterdam - Experiences testing safety critical systems
2010-03-31 - VU Amsterdam - Experiences testing safety critical systems2010-03-31 - VU Amsterdam - Experiences testing safety critical systems
2010-03-31 - VU Amsterdam - Experiences testing safety critical systems
 
Celtic holidays in the usa
Celtic holidays in the usaCeltic holidays in the usa
Celtic holidays in the usa
 
I16 Intelligent Keypad
I16 Intelligent Keypad I16 Intelligent Keypad
I16 Intelligent Keypad
 

Similar to Sql server classes in mumbai

Ado dot net complete meterial (1)
Ado dot net complete meterial (1)Ado dot net complete meterial (1)
Ado dot net complete meterial (1)
Mubarak Hussain
 
Ch06 ado.net fundamentals
Ch06 ado.net fundamentalsCh06 ado.net fundamentals
Ch06 ado.net fundamentals
Madhuri Kavade
 
Is2215 lecture7 lecturer_ado_intro
Is2215 lecture7 lecturer_ado_introIs2215 lecture7 lecturer_ado_intro
Is2215 lecture7 lecturer_ado_intro
dannygriff1
 
Connected data classes
Connected data classesConnected data classes
Connected data classes
aspnet123
 
Introduction to ado
Introduction to adoIntroduction to ado
Introduction to ado
Harman Bajwa
 
jdbc_presentation.ppt
jdbc_presentation.pptjdbc_presentation.ppt
jdbc_presentation.ppt
DrMeenakshiS
 

Similar to Sql server classes in mumbai (20)

Ado dot net complete meterial (1)
Ado dot net complete meterial (1)Ado dot net complete meterial (1)
Ado dot net complete meterial (1)
 
Ch06 ado.net fundamentals
Ch06 ado.net fundamentalsCh06 ado.net fundamentals
Ch06 ado.net fundamentals
 
Ado.net
Ado.netAdo.net
Ado.net
 
ADO .Net
ADO .Net ADO .Net
ADO .Net
 
Is2215 lecture7 lecturer_ado_intro
Is2215 lecture7 lecturer_ado_introIs2215 lecture7 lecturer_ado_intro
Is2215 lecture7 lecturer_ado_intro
 
Connected data classes
Connected data classesConnected data classes
Connected data classes
 
unit 3.docx
unit 3.docxunit 3.docx
unit 3.docx
 
PPT temp.pptx
PPT temp.pptxPPT temp.pptx
PPT temp.pptx
 
Final Database Connectivity in JAVA.ppt
Final Database Connectivity in JAVA.pptFinal Database Connectivity in JAVA.ppt
Final Database Connectivity in JAVA.ppt
 
Introduction to ado
Introduction to adoIntroduction to ado
Introduction to ado
 
Ado.Net Tutorial
Ado.Net TutorialAdo.Net Tutorial
Ado.Net Tutorial
 
PATTERNS07 - Data Representation in C#
PATTERNS07 - Data Representation in C#PATTERNS07 - Data Representation in C#
PATTERNS07 - Data Representation in C#
 
Jdbc
JdbcJdbc
Jdbc
 
Advance Java Programming (CM5I)5.Interacting with-database
Advance Java Programming (CM5I)5.Interacting with-databaseAdvance Java Programming (CM5I)5.Interacting with-database
Advance Java Programming (CM5I)5.Interacting with-database
 
6 database
6 database 6 database
6 database
 
jdbc_presentation.ppt
jdbc_presentation.pptjdbc_presentation.ppt
jdbc_presentation.ppt
 
Introduction to ado.net
Introduction to ado.netIntroduction to ado.net
Introduction to ado.net
 
Database Basics Taac 2005
Database Basics Taac 2005Database Basics Taac 2005
Database Basics Taac 2005
 
Ch 7 data binding
Ch 7 data bindingCh 7 data binding
Ch 7 data binding
 
Ado
AdoAdo
Ado
 

More from Vibrant Technologies & Computers

More from Vibrant Technologies & Computers (20)

Buisness analyst business analysis overview ppt 5
Buisness analyst business analysis overview ppt 5Buisness analyst business analysis overview ppt 5
Buisness analyst business analysis overview ppt 5
 
SQL Introduction to displaying data from multiple tables
SQL Introduction to displaying data from multiple tables  SQL Introduction to displaying data from multiple tables
SQL Introduction to displaying data from multiple tables
 
SQL- Introduction to MySQL
SQL- Introduction to MySQLSQL- Introduction to MySQL
SQL- Introduction to MySQL
 
SQL- Introduction to SQL database
SQL- Introduction to SQL database SQL- Introduction to SQL database
SQL- Introduction to SQL database
 
ITIL - introduction to ITIL
ITIL - introduction to ITILITIL - introduction to ITIL
ITIL - introduction to ITIL
 
Salesforce - Introduction to Security & Access
Salesforce -  Introduction to Security & Access Salesforce -  Introduction to Security & Access
Salesforce - Introduction to Security & Access
 
Data ware housing- Introduction to olap .
Data ware housing- Introduction to  olap .Data ware housing- Introduction to  olap .
Data ware housing- Introduction to olap .
 
Data ware housing - Introduction to data ware housing process.
Data ware housing - Introduction to data ware housing process.Data ware housing - Introduction to data ware housing process.
Data ware housing - Introduction to data ware housing process.
 
Data ware housing- Introduction to data ware housing
Data ware housing- Introduction to data ware housingData ware housing- Introduction to data ware housing
Data ware housing- Introduction to data ware housing
 
Salesforce - classification of cloud computing
Salesforce - classification of cloud computingSalesforce - classification of cloud computing
Salesforce - classification of cloud computing
 
Salesforce - cloud computing fundamental
Salesforce - cloud computing fundamentalSalesforce - cloud computing fundamental
Salesforce - cloud computing fundamental
 
SQL- Introduction to PL/SQL
SQL- Introduction to  PL/SQLSQL- Introduction to  PL/SQL
SQL- Introduction to PL/SQL
 
SQL- Introduction to advanced sql concepts
SQL- Introduction to  advanced sql conceptsSQL- Introduction to  advanced sql concepts
SQL- Introduction to advanced sql concepts
 
SQL Inteoduction to SQL manipulating of data
SQL Inteoduction to SQL manipulating of data   SQL Inteoduction to SQL manipulating of data
SQL Inteoduction to SQL manipulating of data
 
SQL- Introduction to SQL Set Operations
SQL- Introduction to SQL Set OperationsSQL- Introduction to SQL Set Operations
SQL- Introduction to SQL Set Operations
 
Sas - Introduction to designing the data mart
Sas - Introduction to designing the data martSas - Introduction to designing the data mart
Sas - Introduction to designing the data mart
 
Sas - Introduction to working under change management
Sas - Introduction to working under change managementSas - Introduction to working under change management
Sas - Introduction to working under change management
 
SAS - overview of SAS
SAS - overview of SASSAS - overview of SAS
SAS - overview of SAS
 
Teradata - Architecture of Teradata
Teradata - Architecture of TeradataTeradata - Architecture of Teradata
Teradata - Architecture of Teradata
 
Teradata - Restoring Data
Teradata - Restoring Data Teradata - Restoring Data
Teradata - Restoring Data
 

Recently uploaded

1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
QucHHunhnh
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
negromaestrong
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
Chris Hunter
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
heathfieldcps1
 

Recently uploaded (20)

Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural ResourcesEnergy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 

Sql server classes in mumbai

  • 1.
  • 2. Connecting to Microsoft SQL Server Presented By K1/ 4, Second floor, Sector-15/ 16 Market, Vashi, Navi Mumbai. Contact : 9892900103 / 9892900173 wwwwww..vviibbrraanntttteecchhnnoollooggiieess..ccoo..iinn
  • 3. Introduction  We are going to discuss establishing an connection to a SQL Server Database.  You will learn that there is an easy way and a hard way.
  • 4. Agenda  Overview – What do you have to know…  Security Modes  Database Interfaces  Connecting to a SQL Server Data Source
  • 5. Overview – What do you have to know… 1. Server Name 2. Security Information 3. Database name 4. Data Interface / API to use 5. Steps to connect…
  • 6. Security Modes There are two types of modes:  Standard Mode (default)  Integrated Mode CLIENT SQL SERVER Standard and Integrated Security DATABASE Database Security Users, Groups, Permissions
  • 7. Database Interfaces OLE DB DB-ODBC Library Data Object Interfaces Application Programming Interfaces ADO RDO VBSQL DAO JET Relational Databases Other Data Sources
  • 8. Connecting to a SQL Server Data Source  Connecting with Data Control  Connecting with ADO Data Control (ADO)  Connecting with ADO Data Control (DSN)  Connecting with ADO Data Control (UDL)  Connecting with ADO (Programmatically)
  • 9. Connecting with Data Control  Natively it can’t be done…  It uses DAO.  However…  If a Jet Database has already connected to a SQL Server database, then we can connect to that.  Downside  We’re indirectly connecting (through JET)  Probably not the most efficient way.  DEMO
  • 10. Connecting with ADO Data Control (ADO)  Natively it connects fine  It’s ADO  Set the Connection string property  Set the RecordSource property  DEMO
  • 11. Connecting with ADO Data Control (DSN)  Natively it connects fine  It’s ODBC  Set the Connection string property  Set the RecordSource property
  • 12. Data Source Name (DSN) A DSN is a registry entry (Machine DSN) or text file (File DSN) that contains information about a database and the SQL Server it resides on. Control Panel -> Administrative Tools -> Data Sources (ODBC) Start Menu -> Administrative Tools -> Data Sources (ODBC)
  • 13. Demo – Setting up a Data Source Name
  • 14. Example of a File DSN (Standard) [ODBC] DRIVER=SQL Server UID=sa DATABASE=StateU WSID=DALGOODWIN3 APP=Microsoft® Access SERVER=dalgoodwin3
  • 15. Example of a File DSN (Integrated) [ODBC] DRIVER=SQL Server UID=tgoodwin Trusted_Connection=Yes DATABASE=pubs WSID=DALGOODWIN3 APP=Microsoft Open Database Connectivity SERVER=DALGOODWIN3DALGOODWIN32000
  • 16. DEMO – ADO Control with DSN
  • 17. Connecting with ADO Data Control (UDL)  Natively it connects fine  It’s ADO  Set the Connection string property  Set the RecordSource property
  • 18. Creating a UDL  Create a file with a .UDL extention.  Double-click on the icon.
  • 20. Set the Connection and Test
  • 21. Examine the UDL [oledb] ; Everything after this line is an OLE DB initstring Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;User ID=sa;Initial Catalog=pubs;Data Source=dalgoodwin3dalgoodwin32000 Look familiar? Can you say “Connection string”
  • 22. DEMO – ADO Control with UDL
  • 23. Connecting with ADO (Programmatically)  Declare an ADO connection object  Set the Connection String  Open the Connection  Instantiate the recordset etc….
  • 24. DEMO – Connect with ADO
  • 25. Other ways  RDO – Similar to ADO. Use DSN or DSN-less connection strings  ODBCDirect – Too much for this lesson  ODBC – lots of API calls. Better off with the ADO abstraction.
  • 26. Summary  We discussed establishing an connection to a SQL Server Database.  We learned that there is an easy way and a hard way  Questions?

Editor's Notes

  1. When creating a connection, you can use one of three sources: a Connection String, an OLE DB file (.UDL), or an ODBC Data Source Name (DSN). When using a DSN, it's likely you will not have to alter any of the other properties of the control. If you have created a Microsoft Data Link file (.UDL), select Use OLE DB File and click Browse to find the file on the computer. If you use a DSN, click Use ODBC Data Source Name and select a DSN from the box, or click New to create one. If you wish to use create a connection string, select Use ConnectionString, and then click Build, and use the Data Link Properties dialog box to create a connection string. After creating the connection string, click OK. The ConnectionString property will be filled with a string like: driver={SQL Server};server=bigsmile;uid=sa;pwd=pwd;database=pubs
  2. Standard Security is the default security Mode for SQL Server. When this mode is in use, the user must enter a login ID and password that have been established for the database. Integrated security allows SQL Server to use Windows authentication. With integrated security, users maintain a single login and password for both Windows NT/2000/XP and SQL Server.
  3. ODBC is the native Interface to SQL Server. It allows you to connect to relational databases only. There are many ODBC driver available for the different relational databases on the market. OLE DB is a COM based low-level interface that will be abstracted for the programmer. It is the preferred database interface and is not limited to connecting to only relational data. DB-Llibrary is a proprietary, legacy data access API for SQL Server. It is somewhat cumbersome and difficult to program.
  4. DSN-less Connections You can open a connection to a database without creating or specifying a named data source. Connections made in this way are called DSN-less, because they don’t require the system administrator to create an ODBC DSN. Rather than relying on information stored in a file or in the system registry, DSN-less connections specify the driver name, and all driver-specific information in the connection string. Whether or not to use a DSN depends on how much flexibility you want. Connection parameters are readily visible to system administrators. As a result, no matter which connection style you use, there are no extra security benefits. Probably the most common reason for using a DSN-less connection is to connect to a database on a system that is not under your direct control. This makes DSN-less connections good for testing and for applications under development. The following DSN-less connection strings contain the minimum parameters required by the ODBC drivers of Access and SQL 6.5: strConAccess = "Driver={Microsoft Access Driver (*.mdb)};DBQ=C:\db.mdb" strConSQL = "Driver={SQL Server};Server=(local);UID=sa;PWD=" Essentially, a DSN-less connection is hard-coded to use a certain driver, user identity, and network location, which makes it bothersome and difficult to update when the database parameters change. Because the variety of connection parameters can differ greatly from one ODBC data source drive to another, it is recommended that you use a DSN whenever possible.