Sql server classes in mumbai
best Sql server classes in mumbai with job assistance.
our features are:
expert guidance by it industry professionals
lowest fees of 5000
practical exposure to handle projects
well equiped lab
after course resume writing guidance
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)
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
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”
23. Connecting with ADO (Programmatically)
Declare an ADO connection object
Set the Connection String
Open the Connection
Instantiate the recordset etc….
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
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
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.
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.
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.