Tutorial 10 by Sam ine1020 Introduction to Internet Engineering 1 Database & Server-side Scripting Tutorial 10
Tutorial 10 by Samine1020 Introduction to Internet Engineering2 Creating Database ► Microsoft Access Example Create a blank database Create a table in database
Tutorial 10 by Samine1020 Introduction to Internet Engineering3 Creating Database ► Setting attribute
Tutorial 10 by Samine1020 Introduction to Internet Engineering4 Creating Database ► Setting primary key
Tutorial 10 by Samine1020 Introduction to Internet Engineering5 Query Database
Tutorial 10 by Samine1020 Introduction to Internet Engineering6 Query Database - Design View
Tutorial 10 by Samine1020 Introduction to Internet Engineering7 Query Database – Design View
Tutorial 10 by Samine1020 Introduction to Internet Engineering8 Query Database – SQL
Tutorial 10 by Samine1020 Introduction to Internet Engineering9 Database Access ► Microsoft Universal Data Access (UDA) Easy to use programming interface Access for relational & non-relational database Application or Browser ADO ODBC OLE DB Relational data sources Non-relational data sources Mainframe/legacy data
Tutorial 10 by Samine1020 Introduction to Internet Engineering10 Database Access ► OLE DB (Object Linking and Ebedding DB) Open specification Core architecture Application or Browser ADO ODBC OLE DB Relational data sources Non-relational data sources Mainframe/legacy data
Tutorial 10 by Samine1020 Introduction to Internet Engineering11 Database Access ► ODBC (Open Database Connectivity) Access data from a variety of DBMS through a single interface Application or Browser ADO ODBC OLE DB Relational data sources Non-relational data sources Mainframe/legacy data
Tutorial 10 by Samine1020 Introduction to Internet Engineering12 Database Access ► ADO (ActiveX Data Objects) Ease to use, high performance, low memory overhead Application or Browser ADO ODBC OLE DB Relational data sources Non-relational data sources Mainframe/legacy data
Tutorial 10 by Samine1020 Introduction to Internet Engineering13 Registering a Database ► Specific instructions for Windows 98/2000/XP: double-click the ODBC Data Sources (32 bit) icon in the Windows Control Panel to display the ODBC Data Source Administrator dialog. - Click the System DSN tab to view a list of all systems DSNs. - Select the name to the right of Microsoft Access Driver (*.mdb) from the list.
Tutorial 10 by Samine1020 Introduction to Internet Engineering14 Registering a Database Click Add … to display the Create New Data Source dialog. Select Microsoft Access Driver (*.mdb) and click Finish to display the ODBC Microsoft Access Setup dialog.
Tutorial 10 by Samine1020 Introduction to Internet Engineering15 Registering a Database Enter the Data Source Name and Description field. Click the Select … button to display the Select Database dialog. Select the database that you want. Click OK to close this dialog.
Tutorial 10 by Samine1020 Introduction to Internet Engineering16 Registering a Database
Tutorial 10 by Samine1020 Introduction to Internet Engineering17 Registering a Database The Banking DSN is now listed.
Tutorial 10 by Samine1020 Introduction to Internet Engineering18 Active Server Pages (ASP) ► Server-side scripting ASP file contains HTML and scripting code VBScript de facto language for ASP scripting ► Other languages can be used JavaScript .asp file extension Send dynamic Web content ► HTML ► DHTML ► ActiveX controls ► Client-side scripts ► Java applets
Tutorial 10 by Samine1020 Introduction to Internet Engineering19 Active Server Pages (ASP) ► ASP requires Web server ► Personal Web Server (PWS) ► Internet Information Server (IIS) ► How ASP works ? Client sends request ► Server receives request and directs it to ASP ► ASP processes, then returns result to client Server processes ASP file ► Parsed (top to bottom) by ActiveX component asp.dll ► Parsed each time requested ► Web server must support ASP by providing component such as asp.dll
Tutorial 10 by Samine1020 Introduction to Internet Engineering20 Active Server Pages (ASP) ► ASP has several built-in objects Request object ► Access information passed by HTTP GET or POST ► Used to access cookies Response object ► Sends information such as HTML or text to client Server object ► Provides access to server methods and properties ► Provides method CreateObject Used to instantiate other objects
Tutorial 10 by Samine1020 Introduction to Internet Engineering21 Active Server Pages (ASP) ► Scripting delimiters Indicate code is to be executed on server, not client Specify scripting language (default VBScript) ► Each time page refreshed, server loads and interprets ASP
Tutorial 10 by Samine1020 Introduction to Internet Engineering22 ASP/ADO Data.html Sample Database Query Querying an ODBC database. <INPUT TYPE = "TEXT" NAME = "QUERY" SIZE = 40 VALUE = "SELECT * FROM Info">
Tutorial 10 by Samine1020 Introduction to Internet Engineering23 ASP/ADO Data.asp The result of querying an ODBC database <% ' Open a database connection Set connection = Server.CreateObject( "ADODB.Connection" ) connection.Open( "db2" ) ' Open a record set Set recorderset = Server.CreateObject( "ADODB.RecordSet" ) recorderset.ActiveConnection=connection recorderset.Source=query recorderset.Open%> <% ' Iterate through the record set and create a new row ' in the table for each record While Not recorderset.EOF %> <% recorderset.MoveNext() Wend ' Close the record set and the connection recorderset.Close() connection.close() %>
Tutorial 10 by Samine1020 Introduction to Internet Engineering24 ASP / ADO
Tutorial 10 by Samine1020 Introduction to Internet Engineering25 Dreamweaver MX ► Database Window
Tutorial 10 by Samine1020 Introduction to Internet Engineering26 Dreamweaver MX ► Recordset
Tutorial 10 by Samine1020 Introduction to Internet Engineering27 Dreamweaver MX ► Server Behaviors Repeat regions Dynamic text