Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Look up keyword
Like this
9Activity
0 of .
Results for:
No results containing your search query
P. 1
Basic Database Concepts

Basic Database Concepts

Ratings: (0)|Views: 203 |Likes:
Published by manchana

More info:

Published by: manchana on Dec 13, 2009
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as DOC, PDF, TXT or read online from Scribd
See more
See less

05/06/2011

pdf

text

original

 
Basic Database Concepts
Database Basics
A
database
is a collection of information applicable to a particular subject or purpose.The data is typically grouped into specific categories of information, which are containedin data storage files called
TABLE
s. A database can have multiple tables.Tables organize data into rows called
RECORDS
and columns called
FIELDS
.A table's structure defines the type of fields needed to contain the desired information.For example, a table's fields can store different data types such as character strings,integers, floating-point numbers, dates, and even images, which are specified at the timea table is created.You can think of a database table as an advanced type of an index-card file. For example,an employee phone list consists of index cards filed in alphabetical order by theemployees' last names. Each card contains an employee's ID number, last name, firstname, and company phone extension.Together, all the cards in the index-card file make up a
TABLE
. Each employee's cardcomprises a
RECORD
, and each item that stores specific information about theemployee corresponds to a
FIELD
. In the employee phone list, for example, theemployee's first name is one field; the last name is another field, and so on.We use these fields to gain access to the information we want in the database. Typically,we use the field name or label that identifies the field (for example,
LastName
), to set or retrieve the value that is stored in the field (for example, '
Smith
').
 
A database can also have multiple
VIEW
s. A view has records and fields just like a table, but it can contain information from different tables. In some relational databasemanagement systems (
RDBMS
), a view is called a
query
, and it can accept parametersthat change the information it displays.In subsequent articles, we shall take a closer look at how to display information from, andinput information to, the records and fields of a database. But first, we need to know howto access the data source.
onnecting to a database
The very first step in accessing database information is to establish a connection with thedatabase source. ADO provides the
Connection
object to manage connections between aWeb page and a database.To establish a connection, first create an instance of the
Connection
object.
Set connObj=Server.CreateObject("ADODB.Connection")
Then open the connection with the specified parameters:
connObj.Open ConnectionString, UserID, Password
which establishes the physical link to a data source. When the method successfullycompletes, the connection is "
live
" and you can issue commands against it and processthe results.The
ConnectionString
parameter specifies a data source, while
UserID
and
Password
are optional arguments that may be omitted if not needed when establishing the link.The connection string typically specifies the name, location, and type of database youwant to access, along with any other parameters it may require, and passed as a series of 
argument=value
statements separated by semicolons. For example:
"Driver={SQL Server}; Server=bigsmile; Database=pubs;UID=sa; PWD=pwd"
NOTE:
The connection string MUST NOT contain any spaces, either before or after the equal (=) sign, and must be written as a single line without any line breaks. The codeexamples shown here are done so only for readability.The ConnectionString can be set before opening the Connection object
connObj.ConnectionString="Driver={SQL Server};Server=bigsmile; Database=pubs; UID=sa; PWD=pwd"connObj.Open
 
or can be assigned to a
reference
variable, that is then passed as the argument to set theconnection parameter during the
Open
method call.
strConn="Driver={SQL Server}; Server=bigsmile; Database=pubs;UID=sa; PWD=pwd"connObj.Open strConn
The
UserId
and
Password
information must be passed ONLY once, either in theoptional
UID
and
PWD
arguments in the string details, or as arguments to the
Open
method of the
Connection
object itself, but NOT in both, as the results may beunpredictable.In most Intranets and Local Area Network (LAN) applications, connection strings areusually "predefined" in a
Data Source Name (DSN)
.
The Data Source Name (DSN)
A
Data Source Name
(
DSN
) contains all the information needed to locate, identify, andcommunicate with a particular 
OLE-DB
or 
ODBC
compliant database driver — the program that passes information to and from a Web application and the database. TheDSN can take the form of an entry in the Windows NT registry or a text file.Basically, a DSN is built using the
ODBC Administrator
in Control Panel in the Webserver. With ODBC, we have a choice of creating a
User
,
System
, or 
File
DSN.The
User
and
System
DSN reside in the Windows NT registry. The System DSN enablesall users logged on to a particular server to access a database, while the User DSN limitsdatabase connectivity to a specific user with appropriate security credentials.The File DSN, which takes the form of a text file, provides access to multiple users and iseasily transferable from one server to another by simply copying DSN files. For thesereasons, the File DSN is more widely used.Below is what a FileDSN is typically made up of:
[ODBC]DRIVER=Microsoft Access Driver (*.mdb)UID=adminUserCommitSync=YesThreads=3SafeTransactions=0PageTimeout=5MaxScanRows=8MaxBufferSize=2048FIL=MS AccessDriverId=281DefaultDir=C:\Inetpub\wwwroot\aspxtreme\shared\dataDBQ=C:\Inetpub\wwwroot\aspxtreme\shared\data\dbtutor.mdb

Activity (9)

You've already reviewed this. Edit your review.
1 thousand reads
1 hundred reads
ALi liked this
vasant003 liked this
minipuppy liked this
rizrose1 liked this
Rameshlnt liked this
david jack liked this

You're Reading a Free Preview

Download
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->