COMP S834. Unit 5. Databases and session management

Size: px
Start display at page:

Download "COMP S834. Unit 5. Databases and session management"

Transcription

1 COMP S834 Unit 5 Databases and session management 120

2 Course team Developer: Designer: Coordinator: Member: Jenny Lim, Consultant Chris Baker, OUHK Dr Li Tak Sing, OUHK Dr Andrew Lui Kwok Fai, OUHK External Course Assessor Prof. Mingshu Li, Institute of Software, Chinese Academy of Sciences Production ETPU Publishing Team Copyright The Open University of Hong Kong, Revised All rights reserved. No part of this material may be reproduced in any form by any means without permission in writing from the President, The Open University of Hong Kong. Sale of this material is prohibited. The Open University of Hong Kong 30 Good Shepherd Street Ho Man Tin, Kowloon Hong Kong

3 Contents Overview 1 Introduction 3 Database concepts 4 Relational databases 6 Database management systems (DBMS) 9 Structured Query Language (SQL) 13 PHP and MySQL 20 ABC Books: our case study business 20 PHP MySQL functions 20 Open Database Connectivity (ODBC) 23 Database abstraction 27 Session management mechanisms 30 Client-side techniques 31 Server-side techniques 36 Issues in state management 43 Ensuring security 43 Managing sessions across multiple servers 43 Summary 45 Suggested answers to self-tests 46 References 50

4 Unit 5 1 Overview Databases are used in any information system which needs to store, organize and manage large amounts of data. They also play an important role in making an organization s information resources available online. Product catalogues, customer orders and user registrations are just some of the types of data that can be stored in back-end databases which are connected to the Web. In the first part of this unit, we ll briefly look at the history of databases. We also look at the most common data model used by database systems today: the relational model. We then discuss the ways in which users can access Web databases and will look at the basic SQL commands that are used for retrieving and updating information in a database. We will also look at how these commands can be incorporated within a server-side script written in a language such as PHP. The second half of the unit deals with session management. In general, a session begins when a user visits the first page on the site, and ends when he/she clicks onto a new site or remains inactive for a long period of time. There are many situations when a Web server needs to keep track of what has been going on within a user session. For example, search engine sites must know the page you are currently viewing so that they can retrieve the previous or next page of results correctly. Shopping sites need to match online shoppers with their virtual shopping baskets through all the pages that they visit. However, HTTP is a stateless protocol, which means that a Web server processes each request for a new webpage as a discrete unit, without retaining any knowledge of previous pages requested within the same user session. This design approach leads to better performance and scalability. However, many Web applications depend on the ability to track individual requests from distinct users and store information about the current state of a session for each client. We will look at a number of techniques which are used to store session information for HTTP clients. We will also discuss the pros and cons of each of these methods. These techniques are all implemented within the application level due to the lack of support for it in the underlying protocol. Using database technology and the session management techniques you ve learned, you will implement a shopping cart application for ABC Books. This will allow shoppers to browse and select books from a product catalogue database running behind their website. Session management techniques will be used to identify each user and to keep track of the items in their shopping cart. Once again, we will use PHP and MySQL to implement this application.

5 2 COMP S834 Web Server Technology In short, this unit: describes how databases can be integrated into Web applications; discusses the necessary technologies for implementing Web-database connectivity; examines how session management can be performed within a stateless protocol like HTTP; helps you to construct a Web application which interfaces with databases and maintains state over a series of HTTP requests; and explains relevant issues when planning and adopting a session management strategy for a website. This unit should take you about five weeks or hours to complete. Please plan your time carefully and remember to contact your tutor if you have problems.

6 Unit 5 3 Introduction Static HTML pages are adequate for publishing small amounts of information that does not change frequently. By contrast, dynamic HTML pages are required for publishing data which changes very often or when your users need to enter and retrieve live data from a database using a form. Most e-commerce sites nowadays make use of back-end databases to store their content. Server-side programs are then used to assemble the data from the database in many different ways in response to specific user requests. Relational database management systems are the most common technology used for storing, organizing and managing Web databases. Server-side programs can issue calls against the database using standard technologies such as Open Database Connectivity (ODBC) or through built-in functions provided by the scripting language. Requests for retrieving, updating, or adding records to the database are written using another standard known as SQL (Structured Query Language). The Web server interfaces with server-side programs and application servers which, in turn, issue the requests to back-end databases. Web server Web browser Completed form HTML result HTTP Server-side script Send query to DB Build HTML with results Query Results Database Figure 5.1 Web-database connection To implement shopping carts, user preferences, or detailed visitor tracking, the server must be able to recognize a user throughout an entire session, from one page to the next. This is the essence of session management. As mentioned in the Overview, session management is not so straightforward under HTTP and must be implemented within the Web application itself. We will discuss both client-side and server-side techniques for managing user sessions. Client-side techniques, such as cookies, involve storing the session data on the client machine. Server-side techniques involve storing the session state within a file or database on the Web server itself. That s right, databases are used not just for storing and organizing website content, they also play a very important role in session management! Implementing the session management techniques discussed in this unit will help you deliver a richer, more interactive Web environment to your users.

7 4 COMP S834 Web Server Technology Database concepts We ll start this section with a brief history of databases. We will also look at the most common data model used by database systems today: the relational model. We ll discuss the core concepts of the relational model and show you how data is stored and organized based on this model. Towards the end of the section, you will get a chance to perform data administration and manipulation tasks using MySQL, a very popular open-source database management system which uses the relational data model. Flat files The business world started adopting computers for their data processing needs after World War II. Using the same approach as scientists and engineers, businesses originally stored data in flat files where data was organized in tabular format. Rows in the table were called records and columns were called fields. (In Figure 5.2, records give information about individual students while fields deal with categories such as students names, subjects or grades.) Marvin Kwok 2003 Semester 1 Chemistry 101 C Alice Tam 2003 Semester 2 Physics 102 B- Betty Cheung 2003 Semester 2 Math 150 B Figure 5.2 A subset of a file containing student results In order to improve the performance of flat files, indexes were built on selected fields which are commonly used to search the file. These index files allowed applications to access records directly rather than searching through the entire file from the very beginning. Flat files were not well-suited for the storage and management of significant volumes of data. A flat-file structure only contains a single table and is not practical for most business applications, which must store information about multiple entities (e.g. Customer, Order, Invoice, Supplier) that may have relationships with each other. In addition, early data-processing systems tended to grow independently without an overall plan to guide their development. Departments such as accounting, finance, manufacturing, human resources, sales and marketing would develop their own programs and data files in isolation from other functional areas. This approach led to multiple master files which were created, maintained and operated by separate divisions or departments. The next figure illustrates how data is organized within the traditional flat-file environment.

8 Unit 5 5 Prog A Prog B Prog C Prog A Prog B Prog C Order-filing-system Accounting-system Customer- Master- File Inventory- Master- File Order- Master- File Customer- Master- File Inventory- Pricing- File Figure 5.3 Traditional flat-file approach Several problems result from a flat-file approach: 1 Data redundancy and confusion The same employee, customer or product record may appear in several files belonging to different departments. This makes it difficult to keep the same information consistent throughout the organization. 2 Program-data dependence There is a tight relationship or coupling between data stored in flat files and the specific programs required to update and maintain those files. Any change in the file structure, such as adding a new field or increasing the length of an existing field, requires a change in all programs that access the data. 3 Lack of flexibility End-users did not have any tools to access flat files directly. The specialized skills of a programmer were needed in order to write a program which could extract the data and generate the necessary reports. This made it difficult to deliver ad-hoc reports or respond to unanticipated information requirements. Database technology can solve many of the problems created by the traditional flat-file approach. A database is actually a collection of data organized to serve many applications efficiently by centralizing the data and minimizing redundant data. Databases may contain one or more tables. In effect, a single database can serve multiple applications simultaneously. The next figure illustrates the shared database approach.

9 6 COMP S834 Web Server Technology Management Manufacturing Sales and Marketing Corporate database Accounting Human Resources Customer Service Figure 5.4 Shared database environment Databases can be classified by the model or data structures associated with them. Some models have been in wide use for some time, such as the hierarchical and network models. However, the dominant model today is the relational model, used together with the SQL query language. This is the model that we will adopt for the ABCBooks database. Relational databases Relational databases are based on the relational model, which was invented by an IBM researcher named Ted Codd in The relational model is based on relational calculus and algebra, and was meant to allow non-technical users to store and retrieve large amounts of information. Ted Codd envisioned a system where the user would be able to access information with English-like commands, and where information would be stored in tables. Relational databases actually represent data as a collection of twodimensional tables. A table can be visualized as a group of records which, in turn, are made up of fields. Tables are also referred to as files, since each table can be viewed as equivalent to a flat file. However, databases may contain one or more tables, while flat files only hold one table at a time. The next figure illustrates this hierarchy.

10 Unit 5 7 Student database Course enrollment file Payment file Personal history file Course enrollment file Student John Woo Betty Chan Iris Cheung Course IS 100 IS 100 IS 100 Term 2003 Sem Sem Sem3 Grade B+ A B- Course enrollment record Name John Woo Course IS 100 Term 2003 Sem2 Grade B+ Figure 5.5 Data hierarchy in a relational database Each table stores data about a single entity, which could be a person, place, object, event or concept of interest to the business. Books, customers and orders are just some of the entities that will be stored in the ABCBooks database. The rows within a table correspond to the records that contain information about a single instance of an entity. For example, there will be one record within the ABCBooks Book table for A Dream of Red Mansions by Tsao Hsueh-Chin, which is one particular instance of a book title. The fields within a table contain the characteristics or attributes recorded for each entity. Databases generally support three types of fields: numeric types, date and time types, and string or character types. There is a special field known as the primary key, which serves to identify each record uniquely within a table. book ID, title, description, listprice and monthpublished and yearpublished are just some of the fields that may be stored for each book, with the book ID serving as the primary key. The next figure shows an example of the tables and fields for our initial database design for ABC Books. The primary keys are underlined for each table.

11 8 COMP S834 Web Server Technology Customer (customerid, lastname, firstname, middleinit, address1, address2, district, region, phone, , password, join_date, last_login_date) Order (orderno, customerid, dateplaced, dateshipped, totalamount, Status) Order Detail (orderno, orderlineno, bookid, unitprice, quantity, discount) Book (bookid, title, auth_firstname, auth_lastname, auth_middlename, monthpublished, yearpublished, numpages, listprice, description) Author (Author_FirstName, Author_LastName, Author_MiddleName, Biography) Figure 5.6 Sample database design Relational databases can also record the relationships or linkages between tables through common fields which occur in the related tables. In the example above, there is a relationship between the Order table and the Customer table through the field customerid. We can therefore retrieve all the orders for a particular customer by looking for all Order records that contain a specific customerid. We can also look up the customer details for a particular order by using the same ID. customerid is considered a foreign key within the Order table, because it is a primary key in another table. Foreign keys are used to look up information in another table to avoid keeping the same data in more than one place. Here are the three basic operations used to extract data from a relational database: 1 Select creates a subset of records from a file which meet a certain criteria. For example, we may want to select all books written by Mark Twain from the Product table. 2 Join combines fields from more than one table. For example, we may want to join the Product table with the Order Line table so that we can see all the products within an order, along with their descriptions, number of pages and date of publication. 3 Project permits the creation of new tables or views that contain only the information required from the underlying table or tables. For example, some programs may not need all the fields in the Customer table, so a view of this table containing only the fields required may be created and made accessible to these programs. The actual commands for these operations are expressed in Structured Query Language, which you ve used briefly in Activity 4.11 (about fulltext searching with MySQL). The users and application programs who issue these commands do not need to know how these operations will

12 Unit 5 9 actually be carried out. They just need to issue the right instructions and the database will take care of servicing the request. Because of this, relational databases are much more flexibile in accomodating ad-hoc queries, or queries which combine information from different tables and sources. The looser coupling between programs and data also allows the addition of new tables, columns, and records without the need to rewrite the programs that access the database. This has made relational databases very popular with businesses. Self-test Briefly describe the problems caused by using the flat-file structure for storing and organizing data. 2 How is data organized using the relational data model? 3 What is the difference between a primary key and a foreign key? 4 Referring to Figure 5.6, identify two other foreign keys aside from CustomerID. What relationships are established by these keys? Database management systems (DBMS) A database management system is simply the software used to create, access and manipulate databases. The DBMS acts as an interface between application programs and the physical data files. It relieves the programmer or end user from the task of understanding where and how the data is actually stored by separating the logical and physical views of the data. A database management system has three major components: 1 Data Definition Language (DDL) language used to define the content and structure of the database, such as creating and dropping databases and tables. 2 Data Manipulation Language (DML) language used to extract, insert, update and delete data. 3 Data dictionary inventory of all the data elements or fields within the database; it contains metadata or data about the database itself. This allows programs and users to query the server and find out what data structures (e.g. databases, tables, indexes, fields) are stored within. Many popular database management systems operate using the clientserver model, with a database server responding to client requests over a

13 10 COMP S834 Web Server Technology network connection. However, it is also possible for the client and database server to be on the same machine. User 1 User 2 Application 1 Application 2 Data definition Data manipulation Data administration DBMS engine Database Data dictionary Figure 5.7 DBMS serves as an interface between applications, users and the physical data files We will be using MySQL to implement the back-end database for user registration, catalogue search and online ordering on the ABC Books website. The next reading gives you a quick overview of the programs that you will use to administer and manipulate MySQL databases. These programs make up the MySQL DBMS, and are classified as server, client or utility programs. You will use some of these programs in the following activities. Reading 5.1 Overview of MySQL programs, Section 4.1 in MySQL Manual, These programs can be invoked at the command line by entering the program name, followed by any options or other arguments needed to instruct the program. Please note that mysqld is the name of the MySQL database server, and this program must be running before clients can connect to it. In the next activity, we will explore some of the administrative functions that can be performed with MySQL. Activity 5.1 We will now perform some common database administration tasks such as starting and stopping the database server, creating a new database and adding a new user account. We will use three MySQL client programs in this activity mysql, mysqladmin, and mysqlshow. They were all briefly described in Reading 5.1. While you re working through the examples below, you can

14 Unit 5 11 also refer to this URL as a more detailed reference for these and many other useful programs: MySQL client and utility programs, Just a quick reminder before you start typing commands into the interactive MySQL client programs. You re free to type your SQL commands in upper or lower case, but if you re using MySQL on a UNIX-based system, be aware that database and table names are casesensitive. This is because they correspond to directories and files in the MySQL data directory. So if you defined a table as Order_Detail and then try to query it using the name order_detail, MySQL will tell you that the table doesn t exist. Part 1 Starting and stopping a server There are also a number of ways to stop the server, but we will use the script /etc/rc.d/init.d/mysqld to do this. 1 Check whether MySQL is already running: shell> mysqladmin status 2 If MySQL is already running, you can shut it down: shell> /etc/rc.d/init.d/mysqld stop 3 You can restart MySQL using the same script. shell> /etc/rc.d/init.d/mysqld start 4 Now use mysqladmin to check the status of the MySQL server after restarting it: shell> mysqladmin status Part 2 Creating a new database 1 We will now create a new database called ABCBooks using the mysqladmin client program: shell> mysqladmin create ABCBooks 2 Next, verify that the database has been created using the mysqlshow command. This command will give you a listing of all the existing databases on the server. You should see ABCBooks among the databases listed: shell> mysqlshow

15 12 COMP S834 Web Server Technology Part 3 Adding a new user account MySQL is initially installed with default accounts for the root user. These accounts have blank passwords, so anyone can log in to the database as long as they know the account name. For security reasons, however, you do not want your Web server scripts to connect to the database server as root. We will create a new user account to be used by our scripts for accessing and manipulating the ABCBooks database. 1 You will use the mysql client to connect to the MySQL server as root. The mysql client is an interactive program that allows you to connect to a MySQL server, run queries, and view the results: shell>mysql u root Note that if you have already assigned a password to root (which is a good idea), you should include the password using the -p option, with no space between the option switch and the password (i.e. -pmypassword). 2 Once you ve logged in as root, you can select which database you re going to work on from the several databases that the server currently maintains. Since we re going to create a new database user, we need to use the system database called mysql where user accounts are stored: mysql shell> use mysql; 3 User accounts are stored in a table called user within the MySQL database. We will insert a record for our new user into this table. After adding the record, you must tell the server to reload the user account information with FLUSH PRIVILEGES. Without issuing the FLUSH PRIVILEGES command, the server will not recognize the newly-added user until after the server has been restarted. Lastly, we will use the PASSWORD function to encrypt the password before storing it in the user table: mysql shell> insert into user (Host, User, Password) values ( localhost, webuser, PASSWORD( comps834 )); mysql shell> flush privileges; mysql shell> grant select, insert, update, delete, index, alter, create, drop on ABCBooks.* TO localhost identified by comps834 ; We have just created a new user called webuser who is allowed to perform data manipulation (e.g. insert, update, select and delete) and administration (e.g. create and drop) tasks on the ABCBooks database. 4 You can verify that the user has been added correctly by logging into the MySQL client once more using this new account. Exit from the MySQL client command shell with:

16 Unit 5 13 mysql shell> \q Then from the operating system command line, you can log in as the new user. Please note that there must be no space between the -p option switch and the password. You can also specify the database that you want to use (e.g. ABCBooks) as part of the options in the command line up front: shell>mysql u webuser pcomps834 ABCBooks Our ABCBooks database is empty for the moment, but it won t stay that way for long! Now do the following self-test to revise the database management concepts you ve learned in this section. Self-test 5.2 For questions 2 and 3 below, you may want to consult this reference: 1 Describe the steps involved in adding a new database user account to MySQL. 2 Describe four values that are displayed when you run the mysqladmin status command. 3 Write the mysqlshow command that will display information about the Author table in the ABCBooks database. Structured Query Language (SQL) SQL (pronounced ess-que-el ) is a standard, declarative language used to communicate with a relational database. It is declarative because it describes what must be done rather than how it must be done. Application programmers who use SQL statements do not have to worry about how the database will carry out their request. They just have to issue commands using SQL, send the commands to the database server, and the DBMS will carry them out. SQL is used to implement the DDL (Data Definition Language) and DML (Data Manipulation Language) of many popular relational DBMSs such as MySQL, Oracle, Sybase, Microsoft SQL Server, Microsoft Access, Postgress, etc. Be aware that although most database systems use SQL, they may also have their own additional SQL extensions that are available only on their system. This means that different DBMSs may not provide the complete

17 14 COMP S834 Web Server Technology set of SQL functions or may include functions which are not part of the standard. In this unit, we will discuss the standard SQL commands such as Select, Insert, Update, Delete, Create, and Drop. This small set of commands is adequate for accomplishing most of the actions that we will perform on the ABCBooks database. The next reading goes through each of these SQL commands in detail. You can also try submitting your own SQL statements in an online form at the end of each SQL command discussed. Reading 5.2 You may skim through these readings first, just to get a fair idea of what s involved before you start entering SQL commands interactively in the MySQL server on your local machine: 1 Selecting data, 2 Creating tables, 3 Inserting into a table, 4 Updating records, 5 Deleting records, 6 Drop a table, In the next activity, we will issue SQL commands to create and manipulate the tables within the ABCBooks database. The commands will be entered via the MySQL client program, which is an interactive program that allows you to connect to a MySQL server, run queries, and view the results. Activity 5.2 The files needed for this activity can be downloaded from the course website. If you need help while completing the tasks, you can refer to the following portions of the MySQL online documentation: SQL statement syntax, Column types (or types of data supported by MySQL), 1 Use the mysql client to log in to the MySQL server as webuser. Specify that you will be working on the ABCBooks database. (Refer to Activity 5.1 for more information on how to do this.)

18 Unit Now type the following SQL statement into the mysql client command shell. This will create a table called Book, which stores information about the titles sold by ABC Books. The semicolon on the last line denotes the end of the statement. Pressing the Enter key after typing the semicolon will cause the shell to execute the statement: create table Book ( bookid int NOT NULL AUTO_INCREMENT PRIMARY KEY, title varchar(200) NOT NULL, author_lastname varchar(150) NOT NULL, author_firstname varchar(150) NOT NULL, author_middlename varchar(150), imageurl varchar(100), price numeric(8,2), numpages numeric(5), pub_month numeric(2), pub_year numeric(4), description text, fulltext (title, author_lastname, author_firstname, author_middlename, description) ); This statement creates a table named Book with 11 fields. bookid is used as the primary key, which means that an index will be created for this field and no two rows of the table will have the same bookid. A unique number will automatically be generated by MySQL and stored in the bookid field for every new record inserted into the table. title, auth_fname, auth_lname, auth_mname and imageurl are strings of variable lengths. The longest strings that can be stored within these fields are indicated by the numbers within the parentheses. listprice can contain a value with two decimal places. numpages, monthpublished and yearpublished can only contain integers with the specified maximum number of digits, while description can store a very long block of text. 3 Aside from the book description, ABC Books also wants to store short biographies of their authors in the database. We will create a new table called Author so that we can store author-related information separately from the books they ve written. It is more efficient to store one copy of the author s record in a separate table called Author, and then link the Book and Author table through the foreign key fields auth_firstname, auth_lastname and auth_middlename. Let s create the Author table next:

19 16 COMP S834 Web Server Technology create table Author ( auth_lastname varchar(150) NOT NULL, auth_firstname varchar(150) NOT NULL, auth_middlename varchar(150) NOT NULL, auth_bio mediumtext, primary key (auth_lastname, auth_firstname, auth_middlename) ); 4 Next, let s verify that the two tables were created with this command: show tables; We can also check the fields that have been created for these tables. The two commands shown below will be executed separately, one after the other (note the semicolon at the end of each statement): describe Book; describe Author; 5 We have a few more tables to set up, such as Order, Order_Detail and Customer. The CREATE statements for these tables are already in a text file called create_abc.sql, and instead of typing in these statements all over again, we can just tell MySQL to read and execute the contents of the input file for us: source filename; where filename contains the name of our input file, create_abc.sql. 6 Now that all our tables have been created, let s start loading some records into them. The Customer table contains information about users who have registered on the site. It also makes use of an autogenerated ID field to uniquely identify each user, same as the Book table. There are comments in the SQL statement explaining the fields in the Customer table, denoted by two forward slashes (//). These comments are for your information only, and you do not have to enter them into the shell: insert into Customer (firstname, lastname, address1, address2, district, region, phone, , password, join_date) values( Jenny, //first name Lim, //last name N, //middle init Flat D, 22/F Healthy Gardens, address1 305 King s Road, //address2 North Point, //district Hong Kong, //region , //phone jennylim@fre .com, // password( secret ), //password now() //current date );

20 Unit 5 17 Once again, we will use the MySQL password function to encrypt the password in the database. We also keep track of the date when the customer registered on the site with the MySQL now function. 7 Now, you can retrieve the record you just added by using the SELECT command: select * from User where = jennylim@fre .com ; The asterisk(*) denotes that all fields within the table should be retrieved. You can also specify the field names that must be returned, separated by commas. 8 The file load_abc.sql contains more INSERT statements for loading entries into the Book, Author and Customer table. You can run this script file using the source command: source load_abc.sql MySQL would treat the contents of load_abc.sql as commands to be executed. 9 Now, you can check the contents of the two tables by typing the following commands: select * from Book; select * from Author; select * from Customer; 10 Another interesting thing to try is the JOIN operation, which allows you to query information from more than one table. Let s create a SELECT statement which displays the author s biography along with the rest of the information about a book: select bookid, title, auth_firstname, auth_lastname, auth_middlename, listprice, monthpublished, yearpublished, numpages, description, auth_bio from Book, Author where Book.author_lastName = Author.auth_lastName and Book.auth_firstName = Author.auth_firstName and Book.auth_middleName = Author.auth_middleName; 11 Next, let s try the UPDATE and DELETE commands. You can verify that the commands were executed correctly by using SELECT to query the tables before and after issuing the UPDATE and DELETE commands: UPDATE Book SET listprice = where bookid = 5; UPDATE Book SET listprice = listprice *.75 WHERE bookid = 10; DELETE FROM Author WHERE auth_firstname = Eileen and auth_lastname = Chang ;

21 18 COMP S834 Web Server Technology 12 Now, let s try creating indexes on some fields other than the primary key. Indexes can speed up searching on fields which are commonly used as search criteria, such as the book title and the customer s first and last name: CREATE INDEX idx_title ON Book (title); where idx_title is the name of the index, Book is the table and title is the field being indexed. 13 Here s another command which indexes the Book table on the Description field. This field is used for full-text searching, so we have an additional keyword FULLTEXT in the command: CREATE FULLTEXT INDEX idx_ description ON Book (description); 14 Another command that can be used to create an index is the ALTER TABLE command: ALTER TABLE Book ADD INDEX idx_author (auth_lastname, auth_firstname, auth_middlename); 15 The file index_abc.sql contains more statements for creating indexes for the tables in the ABCBooks database. You can run this script file using the source command: source index_abc.sql 16 You can exit the MySQL command shell by typing quit or \q. There are many other useful SQL commands we haven t tried yet. However, the commands you ve learned in this activity should be enough for the majority of the database operations you ll need to perform. Please refer to the SQL statement syntax reference provided at the start of this activity for a complete list of SQL commands available in MySQL. As a summary, here are the SQL statements discussed in this activity: 1 Data definition (DDL) CREATE TABLE; and ALTER TABLE (changing field type and length, adding an index). 2 Data manipulation (DML) INSERT; UPDATE; DELETE; SELECT (single table); and

22 Unit 5 19 SELECT (join). You ve gone through a lot of database operations in this section! You ve also built some of the data structures and loaded all the necessary data into the ABCBooks database. In the next section, you will learn how to issue requests to the database from within an application program. Please complete the following self-test to assess your understanding of SQL. Self-test What will happen if you issue the DELETE statement without specifying any criteria? Example: DELETE FROM AUTHORS; 2 Write an SQL statement that will create an index on the field of the Customer table. 3 Write an SQL statement which retrieves all records from the Book table where the title contains the string Earth. 4 Identify two column types that may be used when defining date/time fields in a table. You can use this URL as a reference:

23 20 COMP S834 Web Server Technology PHP and MySQL Previously, you were issuing commands directly to the database server from a command-line client. In this section, we will incorporate the SQL commands within a PHP program which acts as a client to the database server. The PHP program runs as a server-side script on our Web server. It will process inputs from our Web users and generate dynamic pages from the database in response to their requests. We will start the section by discussing the native PHP functions for accessing MySQL databases. Later on, we will also talk about the Open Database Connectivity (ODBC) programming interface and how this can allow the same program to work with many different databases (not just MySQL). We will end the section with a brief introduction to a programming approach which uses a database abstraction layer to centralize all the database access code within your server-side scripts. ABC Books: our case study business Here s a breakdown of the functions which we will implement for ABC Books. 1 Searching for a book using a variety of methods: by title entire title or part of the title; by author various combinations of first name, last name and middle name (if any); and by keywords full-text search on book titles, book descriptions, author names and author descriptions. 2 Maintaining a shopping cart: Users can add a book to their shopping cart by clicking on an Add to Cart button. The quantity for each book is set to 1 by default but can be updated. Setting the quantity to 0 will remove the book from the cart. Once users have selected all the books they wish to purchase, they can proceed to Order Checkout. At this point, they will have to log in with their address and password before they can continue processing the order. The User Login/Registration and Order Checkout functions will be covered later when we talk about session management. PHP MySQL functions PHP comes with an extensive set of built-in functions that allow it to interface with a wide range of DBMSs, including functions for MySQL,

24 Unit 5 21 msql, PostgreSQL, Oracle, Sybase and Microsoft SQL Server. The next reading describes the most commonly used MySQL functions in PHP. Reading 5.3 Build your own database driven website using PHP & MySQL Part 4: publishing MySQL data on the Web, Note: You only need to go through pages 2 to 5. Here are the relevant functions from the previous reading, along with sample code fragments: 1 mysql_connect establishes a connection to a database. It returns the database connection handler if the connection is successful. If you want to reuse the connection even after the script has ended, you should use mysql_pconnect instead (p stands for persistent). The following sample code can be used to connect to the ABCBooks database with our webuser account. If the connection is unsuccessful, the die function will display the error message and terminate the program afterwards: $conn = mysql_connect( localhost, webuser, comps834 ) or die( Could not connect to MySQL ); Reading 5.3 also provides another way to catch errors as a result of MySQL calls. The author puts the at sign (@) in front of the function name. Then he uses an IF statement to check whether the function returns a true or false value before displaying the error statement. This approach is fine, too. 2 mysql_select_db selects the database to be used. It accepts two parameters the name of the database and the database connection handler: $conn = mysql_connect( localhost, webuser, comps834 ) or die( Could not connect to MySQL ); $selected_db = mysql_select_db( ABCBooks, $conn) or die( Could not select database ); 3 mysql_query sends an SQL query string to the database. It will return a result handler if the request is successfully executed: $conn = mysql_connect( localhost, webuser, comps834 ) or die( Could not connect:. mysql_error()); $selected_db = mysql_select_db( ABCBooks, $conn) or die( Could not select:. mysql_error());

25 22 COMP S834 Web Server Technology $result = mysql_query( SELECT * from Book ); 4 mysql_fetch_object fetches the next row in the result set as an object. The object s properties correspond to the record s fields. This function is usually used in a loop: $conn = mysql_connect( localhost, webuser, comps834 ) or die( Could not connect:. mysql_error()); $selected_db = mysql_select_db( ABCBooks, $conn) or die( Could not select database. mysql_error()); $result = mysql_query( SELECT * from Book ); while ($row = mysql_fetch_object($result)) { echo ( ID. $row->bookid., Title:. $row- >title., Date Published:. $row->monthpublished. /. $row->yearpublished. <br> ); } 5 mysql_close closes non-persistent connections to the MySQL server and returns true or false, depending on its success: $conn = mysql_connect( localhost, webuser, comps834 ) or die( Could not connect:. mysql_error()); mysql_close($conn); In the next activity, you will install these two scripts on your local Web server: search_catalog.php and maintain_cart.php. Activity 5.3 Before you do this activity, please make sure that you have installed the package php-mysql. This can be checked by the following command: rpm -q php-mysql If you have not installed this package, run the following command as root to install it: yum install php-mysql The command will download the package from the internet. So please make sure your computer is connected to the internet.

26 Unit 5 23 Database programming in PHP is easy and convenient given the wide variety of built-in database functions that are available. For MySQL, just use the MySQL functions, for Oracle, use the Oracle functions, and so on. Open Database Connectivity (ODBC) The functions discussed in the previous section provide a highly efficient way to access MySQL databases from your PHP scripts. However, they come with one major limitation. Code written using PHP s native functions for MySQL will no longer work when you switch to another database product. Consider the Search and Shopping Cart functions written for ABC Books in the Activity 5.3. If they were to switch to a PostgreSQL database in the future, the mysql_connect and mysql_query function calls would have to be rewritten using the PHP functions that are specific to PostgreSQL, i.e. pg_connect and pg_query, respectively. ODBC makes it possible for applications to access databases in a standard and uniform way, regardless of the DBMS or operating platform used by the application. It achieves this by inserting a middle layer, called a database driver, between an application and the DBMS. Application program ODBC API ODBC database driver Database Figure 5.8 ODBC serves as a middle layer between an application and the DBMS In the figure above, the application program acts as a client to the database server. An ODBC Data Source Name (DSN) (as shown in figure 5.9) containing the connection parameters for a particular data source must be defined on the client. The configuration file odbc.ini contains information about DSNs available to all users, and this is where you will add an entry for each new data source.

27 24 COMP S834 Web Server Technology [ABCBooks] Description = ABCBooks Driver = MySQL Trace = No TraceFile = Server = localhost User = webuser Password = comps834 Port = 3306 Database = ABCBooks Figure 5.9 ODBC data source for the ABCBooks MySQL database (odbc.ini) The connection parameters for a DSN are then passed to the appropriate ODBC driver, which communicates with the database server itself. Because the ODBC database drivers are loaded at run time, a user only has to install a new driver to access a new DBMS; it is not necessary to recompile or re-link the application. This approach allows a single application to access different DBMSs with the same source code. You will also need to edit odbcinst.ini after installing a new database driver. This configuration file contains information about ODBC drivers available to all users. [MySQL] Description = ODBC for MySQL Driver = /usr/lib/libmyodbc3.so Setup = /usr/lib/libodbcmys.so FileUsage = 1 Figure 5.10 MySQL ODBC database driver (odbcinst.ini) In general, ODBC simplifies connectivity to a database because applications only need to support a single, common API rather than different APIs from various database vendors. However, this approach can increase processing time due to the intermediate step needed to translate between the native database calls and the ODBC API. If performance and speed are key issues for an application, then developers may have to resort to native database APIs at the expense of portability. The next reading describes the iodbc library package on your Linux machine. iodbc is an open source, platform-independent implementation of both the ODBC and X/Open SQL specifications. The reading also comes with sample scripts for issuing ODBC calls from PHP. If you have installed a full Fedora system, then should have unixodbc installed. You can use this instead of iodbc.

28 Unit 5 25 Reading 5.4 Using PHP with ODBC A User Guide, Here are the relevant functions from the previous reading, along with sample code fragments: 1 odbc_connect establishes a connection to an ODBC dataset name (DSN). If you want to reuse the connection even after the script has ended, you should use odbc_pconnect instead (p stands for persistent): $conn = odbc_connect( ABCBooks, webuser, comps834 ) or die(odbc_error()); odbc_error is an ODBC function which returns the error state and error message. 2 odbc_prepare parses and compiles the statement, and then the odbc_execute function (see below) is used to run it later on. This is recommended for statements which will be executed several times (e.g. within a loop), as it can boost performance: $conn = odbc_connect( localhost, webuser, comps834 ) or die( Could not connect:. odbc_error()); $sql = select * from Book where listprice > ; $result = odbc_prepare($conn, $sql) or die("couldn't prepare statement:". odbc_error()); 3 odbc_exec and odbc_do these two functions mean the same thing they will execute an SQL statement on the specified database connection. odbc_exec and odbc_do can also be used to parse, compile and then immediately execute an SQL statement in one step. This approach is fine for SQL statements which will only be run once. Statements which will be run multiple times should be prepared beforehand via odbc_prepare so that they do not have to be parsed and compiled repeatedly for each execution. Example 1 odbc_execute with odbc_prepare $conn = odbc_connect( localhost, webuser, comps834 ) or die( Could not connect:. odbc_error()); $sql = select * from Book where listprice > ; $result = odbc_prepare($conn, $sql) or die ( Could not prepare:. odbc_error());

29 26 COMP S834 Web Server Technology odbc_exec ($result) or die("couldn't execute SQL: ". odbc_error()); Example 2 odbc_exec without a previous odbc_prepare $conn = odbc_connect( localhost, webuser, comps834 ) or die( Could not connect:. odbc_error()); $sql = select * from Book where listprice > ; $result = odbc_exec($conn, $sql) or die ( Couldn t execute SQL:. odbc_error()); 4 odbc_fetch_row fetches the next row from a result set that was returned by odbc_do or odbc_exec. It returns false when there are no more rows left. The resulting fetched row can be accessed via the odbc_result function: $conn = odbc_connect( localhost, webuser, comps834 ) or die(odbc_error()); $sql = select * from Book where listprice > ; $result = odbc_exec($conn, $sql) or die ( Couldn t execute SQL:. odbc_error()); } while (odbc_fetch_row($result)){ $field1 = odbc_result($result, title ); $field2 = odbc_result($result, auth_firstname ); $field3 = odbc_result($result, auth_lastname ); $field4 = odbc_result($result, auth_middlename ); $field5 = odbc_result($result, listprice ); echo Title: $field1, Author: $field2 $field4 $field3, Price: $field3\n ; 5 odbc_close takes a specific connection ID and closes this ODBC connection. You are not required to include this function since any open database connections are automatically closed when your PHP program finishes execution. In the next activity, we will rewrite the two scripts from Activity 5.3 search_catalog.php and maintain_cart.php using ODBC function calls instead of MySQL-specific function calls. Activity 5.4 Before you do this activity, please make sure that you have installed the package php-odbc. This can be checked by the following command:

30 Unit 5 27 rpm -q php-odbc If you have not installed this package, run the following command as root to install it: yum install php-odbc The command will download the package from the internet. So please make sure your computer is connected to the internet. The contents of /etc/odbcinst.ini should look like this. [MySQL] Description = ODBC for MySQL Driver = /usr/lib/libmyodbc3.so Setup = /usr/lib/libodbcmys.so FileUsage = 1 The contents of /etc/odbc.ini should look like this. [ABCBooks] Description = MySQL test database Trace = Off TraceFile = stderr Driver = MySQL SERVER = localhost USER = webuser PASSWORD = comps834 PORT = 3306 DATABASE = ABCBooks We ve discussed how databases can be accessed from PHP by using native database functions and the ODBC Standard API. With ODBC, the same program will work regardless of the back-end database used. However, ODBC could result in slower and less efficient performance due to the middle layer that is inserted between the database and the application program. In the next section, we will briefly introduce another programming approach that can be used for database access within PHP. Database abstraction The main reason for using ODBC is to avoid having to rewrite and retest your programs if you should ever switch to a new database. Another way to avoid this unpleasant situation is to create a database abstraction layer. Database abstraction will create a centralized body of code which

31 28 COMP S834 Web Server Technology handles all interaction with the database. All SQL statements are contained in this centralized body, so any changes only need to be made to this small set of code rather than all over the place. Ideally, a programmer who uses a database abstraction layer does not need to know the details of the underlying database. Even if you do not anticipate switching to another database in the future, a database abstraction layer is still a good idea. Centralizing database access results in cleaner and easier-to-manage code. One way to abstract the database is to wrap each API-specific function in a more generic function called numrows. In the example below, the mysql_num_rows function is wrapped in another function called numrows. PHP application programs would then call the numrows function instead of using the API-specific function directly. If we were to switch to PostgreSQL in the future, we would only have to port the function call from mysql_num_rows to pg_numrows in one place. function numrows($result) { //Return the number of rows in the result set. return (@pg_numrows($result)); } function numrows($result) { //Return the number of rows in the result set. return(@mysql_num_rows($result)); } Aside from writing your own database abstraction layer, there are several that can be downloaded from the Web for free. One of them is PEAR DB, which consists of a set of classes that contains our database functions. It also comes with an object-oriented style query interface. Read the following optional reading if you wish to know more. Reading 5.5 (Optional) Kent, A, Best practices: data abstraction, This concludes our section on accessing MySQL databases from PHP. Do the following self-test to check your understanding of this topic. Self-test Refer to the MySQL documentation for details on the mysql_fetch_assoc function. This can be found under the

A Brief Introduction to MySQL

A Brief Introduction to MySQL A Brief Introduction to MySQL by Derek Schuurman Introduction to Databases A database is a structured collection of logically related data. One common type of database is the relational database, a term

More information

FileMaker 14. ODBC and JDBC Guide

FileMaker 14. ODBC and JDBC Guide FileMaker 14 ODBC and JDBC Guide 2004 2015 FileMaker, Inc. All Rights Reserved. FileMaker, Inc. 5201 Patrick Henry Drive Santa Clara, California 95054 FileMaker and FileMaker Go are trademarks of FileMaker,

More information

Connecting to a Database Using PHP. Prof. Jim Whitehead CMPS 183, Spring 2006 May 15, 2006

Connecting to a Database Using PHP. Prof. Jim Whitehead CMPS 183, Spring 2006 May 15, 2006 Connecting to a Database Using PHP Prof. Jim Whitehead CMPS 183, Spring 2006 May 15, 2006 Rationale Most Web applications: Retrieve information from a database to alter their on-screen display Store user

More information

How to test and debug an ASP.NET application

How to test and debug an ASP.NET application Chapter 4 How to test and debug an ASP.NET application 113 4 How to test and debug an ASP.NET application If you ve done much programming, you know that testing and debugging are often the most difficult

More information

Database 10g Edition: All possible 10g features, either bundled or available at additional cost.

Database 10g Edition: All possible 10g features, either bundled or available at additional cost. Concepts Oracle Corporation offers a wide variety of products. The Oracle Database 10g, the product this exam focuses on, is the centerpiece of the Oracle product set. The "g" in "10g" stands for the Grid

More information

Server side scripting and databases

Server side scripting and databases Three components used in typical web application Server side scripting and databases How Web Applications interact with server side databases Browser Web server Database server Web server Web server Apache

More information

The full setup includes the server itself, the server control panel, Firebird Database Server, and three sample applications with source code.

The full setup includes the server itself, the server control panel, Firebird Database Server, and three sample applications with source code. Content Introduction... 2 Data Access Server Control Panel... 2 Running the Sample Client Applications... 4 Sample Applications Code... 7 Server Side Objects... 8 Sample Usage of Server Side Objects...

More information

CSCI110 Exercise 4: Database - MySQL

CSCI110 Exercise 4: Database - MySQL CSCI110 Exercise 4: Database - MySQL The exercise This exercise is to be completed in the laboratory and your completed work is to be shown to the laboratory tutor. The work should be done in week-8 but

More information

Visual COBOL ASP.NET Shopping Cart Demonstration

Visual COBOL ASP.NET Shopping Cart Demonstration Visual COBOL ASP.NET Shopping Cart Demonstration Overview: The original application that was used as the model for this demonstration was the ASP.NET Commerce Starter Kit (CSVS) demo from Microsoft. The

More information

A table is a collection of related data entries and it consists of columns and rows.

A table is a collection of related data entries and it consists of columns and rows. CST 250 MySQL Notes (Source: www.w3schools.com) MySQL is the most popular open-source database system. What is MySQL? MySQL is a database. The data in MySQL is stored in database objects called tables.

More information

FileMaker 12. ODBC and JDBC Guide

FileMaker 12. ODBC and JDBC Guide FileMaker 12 ODBC and JDBC Guide 2004 2012 FileMaker, Inc. All Rights Reserved. FileMaker, Inc. 5201 Patrick Henry Drive Santa Clara, California 95054 FileMaker and Bento are trademarks of FileMaker, Inc.

More information

Setting Up ALERE with Client/Server Data

Setting Up ALERE with Client/Server Data Setting Up ALERE with Client/Server Data TIW Technology, Inc. November 2014 ALERE is a registered trademark of TIW Technology, Inc. The following are registered trademarks or trademarks: FoxPro, SQL Server,

More information

FileMaker 11. ODBC and JDBC Guide

FileMaker 11. ODBC and JDBC Guide FileMaker 11 ODBC and JDBC Guide 2004 2010 FileMaker, Inc. All Rights Reserved. FileMaker, Inc. 5201 Patrick Henry Drive Santa Clara, California 95054 FileMaker is a trademark of FileMaker, Inc. registered

More information

E-Commerce: Designing And Creating An Online Store

E-Commerce: Designing And Creating An Online Store E-Commerce: Designing And Creating An Online Store Introduction About Steve Green Ministries Solo Performance Artist for 19 Years. Released over 26 Records, Several Kids Movies, and Books. My History With

More information

Log Analyzer Reference

Log Analyzer Reference IceWarp Unified Communications Log Analyzer Reference Version 10.4 Printed on 27 February, 2012 Contents Log Analyzer 1 Quick Start... 2 Required Steps... 2 Optional Steps... 3 Advanced Configuration...

More information

FileMaker 13. ODBC and JDBC Guide

FileMaker 13. ODBC and JDBC Guide FileMaker 13 ODBC and JDBC Guide 2004 2013 FileMaker, Inc. All Rights Reserved. FileMaker, Inc. 5201 Patrick Henry Drive Santa Clara, California 95054 FileMaker and Bento are trademarks of FileMaker, Inc.

More information

Alteryx Predictive Analytics for Oracle R

Alteryx Predictive Analytics for Oracle R Alteryx Predictive Analytics for Oracle R I. Software Installation In order to be able to use Alteryx s predictive analytics tools with an Oracle Database connection, your client machine must be configured

More information

CPE111 COMPUTER EXPLORATION

CPE111 COMPUTER EXPLORATION CPE111 COMPUTER EXPLORATION BUILDING A WEB SERVER ASSIGNMENT You will create your own web application on your local web server in your newly installed Ubuntu Desktop on Oracle VM VirtualBox. This is a

More information

Writing Scripts with PHP s PEAR DB Module

Writing Scripts with PHP s PEAR DB Module Writing Scripts with PHP s PEAR DB Module Paul DuBois paul@kitebird.com Document revision: 1.02 Last update: 2005-12-30 As a web programming language, one of PHP s strengths traditionally has been to make

More information

SQL Injection Attack Lab Using Collabtive

SQL Injection Attack Lab Using Collabtive Laboratory for Computer Security Education 1 SQL Injection Attack Lab Using Collabtive (Web Application: Collabtive) Copyright c 2006-2011 Wenliang Du, Syracuse University. The development of this document

More information

Advantage Database Server

Advantage Database Server whitepaper Advantage Database Server Scalability Technical Brief A whitepaper from Sybase ianywhere TABLE OF CONTENTS 1 Introduction 2 Specifications 2 Tables 2 Server Machine 2 Client Machine 2 Development

More information

IceWarp Server. Log Analyzer. Version 10

IceWarp Server. Log Analyzer. Version 10 IceWarp Server Log Analyzer Version 10 Printed on 23 June, 2009 i Contents Log Analyzer 1 Quick Start... 2 Required Steps... 2 Optional Steps... 2 Advanced Configuration... 5 Log Importer... 6 General...

More information

Web Development on the SOEN 6011 Server

Web Development on the SOEN 6011 Server Web Development on the SOEN 6011 Server Stephen Barret October 30, 2007 Introduction Systems structured around Fowler s patterns of Enterprise Application Architecture (EAA) require a multi-tiered environment

More information

How-To: MySQL as a linked server in MS SQL Server

How-To: MySQL as a linked server in MS SQL Server How-To: MySQL as a linked server in MS SQL Server 1 Introduction... 2 2 Why do I want to do this?... 3 3 How?... 4 3.1 Step 1: Create table in SQL Server... 4 3.2 Step 2: Create an identical table in MySQL...

More information

Architecting the Future of Big Data

Architecting the Future of Big Data Hive ODBC Driver User Guide Revised: July 22, 2014 2012-2014 Hortonworks Inc. All Rights Reserved. Parts of this Program and Documentation include proprietary software and content that is copyrighted and

More information

FileMaker Server 11. FileMaker Server Help

FileMaker Server 11. FileMaker Server Help FileMaker Server 11 FileMaker Server Help 2010 FileMaker, Inc. All Rights Reserved. FileMaker, Inc. 5201 Patrick Henry Drive Santa Clara, California 95054 FileMaker is a trademark of FileMaker, Inc. registered

More information

Guide to Upsizing from Access to SQL Server

Guide to Upsizing from Access to SQL Server Guide to Upsizing from Access to SQL Server An introduction to the issues involved in upsizing an application from Microsoft Access to SQL Server January 2003 Aztec Computing 1 Why Should I Consider Upsizing

More information

Oracle Database 10g Express

Oracle Database 10g Express Oracle Database 10g Express This tutorial prepares the Oracle Database 10g Express Edition Developer to perform common development and administrative tasks of Oracle Database 10g Express Edition. Objectives

More information

Application note: SQL@CHIP Connecting the IPC@CHIP to a Database

Application note: SQL@CHIP Connecting the IPC@CHIP to a Database Application note: SQL@CHIP Connecting the IPC@CHIP to a Database 1. Introduction This application note describes how to connect an IPC@CHIP to a database and exchange data between those. As there are no

More information

Suite. How to Use GrandMaster Suite. Exporting with ODBC

Suite. How to Use GrandMaster Suite. Exporting with ODBC Suite How to Use GrandMaster Suite Exporting with ODBC This page intentionally left blank ODBC Export 3 Table of Contents: HOW TO USE GRANDMASTER SUITE - EXPORTING WITH ODBC...4 OVERVIEW...4 WHAT IS ODBC?...

More information

MySQL Quick Start Guide

MySQL Quick Start Guide Fasthosts Customer Support MySQL Quick Start Guide This guide will help you: Add a MySQL database to your account. Find your database. Add additional users. Use the MySQL command-line tools through ssh.

More information

Qlik REST Connector Installation and User Guide

Qlik REST Connector Installation and User Guide Qlik REST Connector Installation and User Guide Qlik REST Connector Version 1.0 Newton, Massachusetts, November 2015 Authored by QlikTech International AB Copyright QlikTech International AB 2015, All

More information

http://alice.teaparty.wonderland.com:23054/dormouse/bio.htm

http://alice.teaparty.wonderland.com:23054/dormouse/bio.htm Client/Server paradigm As we know, the World Wide Web is accessed thru the use of a Web Browser, more technically known as a Web Client. 1 A Web Client makes requests of a Web Server 2, which is software

More information

FileMaker Server 13. FileMaker Server Help

FileMaker Server 13. FileMaker Server Help FileMaker Server 13 FileMaker Server Help 2010-2013 FileMaker, Inc. All Rights Reserved. FileMaker, Inc. 5201 Patrick Henry Drive Santa Clara, California 95054 FileMaker and Bento are trademarks of FileMaker,

More information

Trusted RUBIX TM. Version 6. ODBC Guide. Revision 7 RELATIONAL DATABASE MANAGEMENT SYSTEM TEL +1-202-412-0152. Infosystems Technology, Inc.

Trusted RUBIX TM. Version 6. ODBC Guide. Revision 7 RELATIONAL DATABASE MANAGEMENT SYSTEM TEL +1-202-412-0152. Infosystems Technology, Inc. Trusted RUBIX TM Version 6 ODBC Guide Revision 7 RELATIONAL DATABASE MANAGEMENT SYSTEM Infosystems Technology, Inc. 4 Professional Dr - Suite 118 Gaithersburg, MD 20879 TEL +1-202-412-0152 1981, 2014 Infosystems

More information

Developing Web Applications for Microsoft SQL Server Databases - What you need to know

Developing Web Applications for Microsoft SQL Server Databases - What you need to know Developing Web Applications for Microsoft SQL Server Databases - What you need to know ATEC2008 Conference Session Description Alpha Five s web components simplify working with SQL databases, but what

More information

Cloudera ODBC Driver for Apache Hive Version 2.5.16

Cloudera ODBC Driver for Apache Hive Version 2.5.16 Cloudera ODBC Driver for Apache Hive Version 2.5.16 Important Notice 2010-2015 Cloudera, Inc. All rights reserved. Cloudera, the Cloudera logo, Cloudera Impala, Impala, and any other product or service

More information

1 File Processing Systems

1 File Processing Systems COMP 378 Database Systems Notes for Chapter 1 of Database System Concepts Introduction A database management system (DBMS) is a collection of data and an integrated set of programs that access that data.

More information

DbSchema Tutorial with Introduction in SQL Databases

DbSchema Tutorial with Introduction in SQL Databases DbSchema Tutorial with Introduction in SQL Databases Contents Connect to the Database and Create First Tables... 2 Create Foreign Keys... 7 Create Indexes... 9 Generate Random Data... 11 Relational Data

More information

FileMaker Server 10 Help

FileMaker Server 10 Help FileMaker Server 10 Help 2007-2009 FileMaker, Inc. All Rights Reserved. FileMaker, Inc. 5201 Patrick Henry Drive Santa Clara, California 95054 FileMaker, the file folder logo, Bento and the Bento logo

More information

Designing and Implementing an Online Bookstore Website

Designing and Implementing an Online Bookstore Website KEMI-TORNIO UNIVERSITY OF APPLIED SCIENCES TECHNOLOGY Cha Li Designing and Implementing an Online Bookstore Website The Bachelor s Thesis Information Technology programme Kemi 2011 Cha Li BACHELOR S THESIS

More information

DataFlex Connectivity Kit For ODBC User's Guide. Version 2.2

DataFlex Connectivity Kit For ODBC User's Guide. Version 2.2 DataFlex Connectivity Kit For ODBC User's Guide Version 2.2 Newsgroup: news://dataaccess.com/dac-public-newsgroups.connectivity- Kit_Support Internet Address (URL): http://www.dataaccess.com FTP Site:

More information

Connecting LISTSERV to an Existing Database Management System (DBMS)

Connecting LISTSERV to an Existing Database Management System (DBMS) Whitepaper Connecting LISTSERV to an Existing Database Management System (DBMS) September 14, 2010 Copyright 2010 L-Soft international, Inc. Information in this document is subject to change without notice.

More information

INSTALLING, CONFIGURING, AND DEVELOPING WITH XAMPP

INSTALLING, CONFIGURING, AND DEVELOPING WITH XAMPP INSTALLING, CONFIGURING, AND DEVELOPING WITH XAMPP by Dalibor D. Dvorski, March 2007 Skills Canada Ontario DISCLAIMER: A lot of care has been taken in the accuracy of information provided in this article,

More information

for Networks Installation Guide for the application on a server September 2015 (GUIDE 2) Memory Booster version 1.3-N and later

for Networks Installation Guide for the application on a server September 2015 (GUIDE 2) Memory Booster version 1.3-N and later for Networks Installation Guide for the application on a server September 2015 (GUIDE 2) Memory Booster version 1.3-N and later Copyright 2015, Lucid Innovations Limited. All Rights Reserved Lucid Research

More information

Database Programming with PL/SQL: Learning Objectives

Database Programming with PL/SQL: Learning Objectives Database Programming with PL/SQL: Learning Objectives This course covers PL/SQL, a procedural language extension to SQL. Through an innovative project-based approach, students learn procedural logic constructs

More information

Architecting the Future of Big Data

Architecting the Future of Big Data Hive ODBC Driver User Guide Revised: July 22, 2013 2012-2013 Hortonworks Inc. All Rights Reserved. Parts of this Program and Documentation include proprietary software and content that is copyrighted and

More information

SQL Injection. Blossom Hands-on exercises for computer forensics and security

SQL Injection. Blossom Hands-on exercises for computer forensics and security Copyright: The development of this document is funded by Higher Education of Academy. Permission is granted to copy, distribute and /or modify this document under a license compliant with the Creative

More information

DBArtisan 8.5 Evaluation Guide. Published: October 2, 2007

DBArtisan 8.5 Evaluation Guide. Published: October 2, 2007 Published: October 2, 2007 Embarcadero Technologies, Inc. 100 California Street, 12th Floor San Francisco, CA 94111 U.S.A. This is a preliminary document and may be changed substantially prior to final

More information

Business Portal for Microsoft Dynamics GP. Key Performance Indicators Release 10.0

Business Portal for Microsoft Dynamics GP. Key Performance Indicators Release 10.0 Business Portal for Microsoft Dynamics GP Key Performance Indicators Release 10.0 Copyright Copyright 2007 Microsoft Corporation. All rights reserved. Complying with all applicable copyright laws is the

More information

DiskPulse DISK CHANGE MONITOR

DiskPulse DISK CHANGE MONITOR DiskPulse DISK CHANGE MONITOR User Manual Version 7.9 Oct 2015 www.diskpulse.com info@flexense.com 1 1 DiskPulse Overview...3 2 DiskPulse Product Versions...5 3 Using Desktop Product Version...6 3.1 Product

More information

StoreGrid Backup Server With MySQL As Backend Database:

StoreGrid Backup Server With MySQL As Backend Database: StoreGrid Backup Server With MySQL As Backend Database: Installing and Configuring MySQL on Linux Overview StoreGrid now supports MySQL as a backend database to store all the clients' backup metadata information.

More information

Installation of PHP, MariaDB, and Apache

Installation of PHP, MariaDB, and Apache Installation of PHP, MariaDB, and Apache A few years ago, one would have had to walk over to the closest pizza store to order a pizza, go over to the bank to transfer money from one account to another

More information

Sendspace Wizard Desktop Tool Step-By-Step Guide

Sendspace Wizard Desktop Tool Step-By-Step Guide Sendspace Wizard Desktop Tool Step-By-Step Guide Copyright 2007 by sendspace.com This publication is designed to provide accurate and authoritative information for users of sendspace, the easy big file

More information

Advanced Tornado TWENTYONE. 21.1 Advanced Tornado. 21.2 Accessing MySQL from Python LAB

Advanced Tornado TWENTYONE. 21.1 Advanced Tornado. 21.2 Accessing MySQL from Python LAB 21.1 Advanced Tornado Advanced Tornado One of the main reasons we might want to use a web framework like Tornado is that they hide a lot of the boilerplate stuff that we don t really care about, like escaping

More information

Short notes on webpage programming languages

Short notes on webpage programming languages Short notes on webpage programming languages What is HTML? HTML is a language for describing web pages. HTML stands for Hyper Text Markup Language HTML is a markup language A markup language is a set of

More information

VP-ASP Shopping Cart Quick Start (Free Version) Guide Version 6.50 March 21 2007

VP-ASP Shopping Cart Quick Start (Free Version) Guide Version 6.50 March 21 2007 VP-ASP Shopping Cart Quick Start (Free Version) Guide Version 6.50 March 21 2007 Rocksalt International Pty Ltd support@vpasp.com www.vpasp.com Table of Contents 1 INTRODUCTION... 3 2 FEATURES... 4 3 WHAT

More information

HELP DESK MANUAL INSTALLATION GUIDE

HELP DESK MANUAL INSTALLATION GUIDE Help Desk 6.5 Manual Installation Guide HELP DESK MANUAL INSTALLATION GUIDE Version 6.5 MS SQL (SQL Server), My SQL, and MS Access Help Desk 6.5 Page 1 Valid as of: 1/15/2008 Help Desk 6.5 Manual Installation

More information

FileMaker Server 14. FileMaker Server Help

FileMaker Server 14. FileMaker Server Help FileMaker Server 14 FileMaker Server Help 2007 2015 FileMaker, Inc. All Rights Reserved. FileMaker, Inc. 5201 Patrick Henry Drive Santa Clara, California 95054 FileMaker and FileMaker Go are trademarks

More information

2874CD1EssentialSQL.qxd 6/25/01 3:06 PM Page 1 Essential SQL Copyright 2001 SYBEX, Inc., Alameda, CA www.sybex.com

2874CD1EssentialSQL.qxd 6/25/01 3:06 PM Page 1 Essential SQL Copyright 2001 SYBEX, Inc., Alameda, CA www.sybex.com Essential SQL 2 Essential SQL This bonus chapter is provided with Mastering Delphi 6. It is a basic introduction to SQL to accompany Chapter 14, Client/Server Programming. RDBMS packages are generally

More information

B.1 Database Design and Definition

B.1 Database Design and Definition Appendix B Database Design B.1 Database Design and Definition Throughout the SQL chapter we connected to and queried the IMDB database. This database was set up by IMDB and available for us to use. But

More information

Business Portal for Microsoft Dynamics GP 2010. User s Guide Release 5.1

Business Portal for Microsoft Dynamics GP 2010. User s Guide Release 5.1 Business Portal for Microsoft Dynamics GP 2010 User s Guide Release 5.1 Copyright Copyright 2011 Microsoft. All rights reserved. Limitation of liability This document is provided as-is. Information and

More information

Configuring and Integrating Oracle

Configuring and Integrating Oracle Configuring and Integrating Oracle The Basics of Oracle 3 Configuring SAM to Monitor an Oracle Database Server 4 This document includes basic information about Oracle and its role with SolarWinds SAM Adding

More information

Multimedia im Netz Online Multimedia Winter semester 2015/16

Multimedia im Netz Online Multimedia Winter semester 2015/16 Multimedia im Netz Online Multimedia Winter semester 2015/16 Tutorial 04 Minor Subject Ludwig-Maximilians-Universität München Online Multimedia WS 2015/16 - Tutorial 04 (NF) - 1 Today s Agenda Repetition:

More information

Setting Up Specify to use a Shared Workstation as a Database Server

Setting Up Specify to use a Shared Workstation as a Database Server Specify Software Project www.specifysoftware.org Setting Up Specify to use a Shared Workstation as a Database Server This installation documentation is intended for workstations that include an installation

More information

Using ODBC with MDaemon 6.5

Using ODBC with MDaemon 6.5 Using ODBC with MDaemon 6.5 Alt-N Technologies, Ltd 1179 Corporate Drive West, #103 Arlington, TX 76006 Tel: (817) 652-0204 2002 Alt-N Technologies. All rights reserved. Other product and company names

More information

7- PHP and MySQL queries

7- PHP and MySQL queries 7- PHP and MySQL queries Course: Cris*na Puente, Rafael Palacios 2010- 1 Introduc*on Introduc?on PHP includes libraries for communica*ng with several databases: MySQL (OpenSource, the use selected for

More information

IceWarp Unified Communications. Installation Guide. Version 10.4

IceWarp Unified Communications. Installation Guide. Version 10.4 IceWarp Unified Communications Installation Guide Version 10.4 Printed on 16 April, 2012 Contents Installation Guide 1 Pre-requisites... 1 Launch Installer Wizard... 2 Select Language... 5 Welcome Screen...

More information

v4.8 Getting Started Guide: Using SpatialWare with MapInfo Professional for Microsoft SQL Server

v4.8 Getting Started Guide: Using SpatialWare with MapInfo Professional for Microsoft SQL Server v4.8 Getting Started Guide: Using SpatialWare with MapInfo Professional for Microsoft SQL Server Information in this document is subject to change without notice and does not represent a commitment on

More information

INFORMATION BROCHURE Certificate Course in Web Design Using PHP/MySQL

INFORMATION BROCHURE Certificate Course in Web Design Using PHP/MySQL INFORMATION BROCHURE OF Certificate Course in Web Design Using PHP/MySQL National Institute of Electronics & Information Technology (An Autonomous Scientific Society of Department of Information Technology,

More information

What is a database? COSC 304 Introduction to Database Systems. Database Introduction. Example Problem. Databases in the Real-World

What is a database? COSC 304 Introduction to Database Systems. Database Introduction. Example Problem. Databases in the Real-World COSC 304 Introduction to Systems Introduction Dr. Ramon Lawrence University of British Columbia Okanagan ramon.lawrence@ubc.ca What is a database? A database is a collection of logically related data for

More information

SOFTWARE INSTALLATION INSTRUCTIONS CLIENT/SERVER EDITION AND WEB COMPONENT VERSION 10

SOFTWARE INSTALLATION INSTRUCTIONS CLIENT/SERVER EDITION AND WEB COMPONENT VERSION 10 3245 University Avenue, Suite 1122 San Diego, California 92104 USA SOFTWARE INSTALLATION INSTRUCTIONS CLIENT/SERVER EDITION AND WEB COMPONENT VERSION 10 Document Number: SII-TT-002 Date Issued: July 8,

More information

User Guide. Analytics Desktop Document Number: 09619414

User Guide. Analytics Desktop Document Number: 09619414 User Guide Analytics Desktop Document Number: 09619414 CONTENTS Guide Overview Description of this guide... ix What s new in this guide...x 1. Getting Started with Analytics Desktop Introduction... 1

More information

SIMIAN systems. Setting up a Sitellite development environment on Windows. Sitellite Content Management System

SIMIAN systems. Setting up a Sitellite development environment on Windows. Sitellite Content Management System Setting up a Sitellite development environment on Windows Sitellite Content Management System Introduction For live deployment, it is strongly recommended that Sitellite be installed on a Unix-based operating

More information

OmniDB - User s Guide

OmniDB - User s Guide OmniDB - User s Guide Rafael T. Castro, Luis Felipe T. Castro and William Ivanski 2016 Rafael T. Castro, Luis Felipe T. Castro and William Ivanski Contents 1. Introduction...........................................

More information

Introduction to Triggers using SQL

Introduction to Triggers using SQL Introduction to Triggers using SQL Kristian Torp Department of Computer Science Aalborg University www.cs.aau.dk/ torp torp@cs.aau.dk November 24, 2011 daisy.aau.dk Kristian Torp (Aalborg University) Introduction

More information

12 File and Database Concepts 13 File and Database Concepts A many-to-many relationship means that one record in a particular record type can be relat

12 File and Database Concepts 13 File and Database Concepts A many-to-many relationship means that one record in a particular record type can be relat 1 Databases 2 File and Database Concepts A database is a collection of information Databases are typically stored as computer files A structured file is similar to a card file or Rolodex because it uses

More information

Designing a Virtual Center for E-Commerce

Designing a Virtual Center for E-Commerce Designing a Virtual Center for E-Commerce Logica BĂNICĂ olga.banica@upit.ro University of PiteştI Doina ROŞCA rosca2na@yahoo.com University of Craiova Abstract In the actual context of developing digital

More information

PHP Tutorial From beginner to master

PHP Tutorial From beginner to master PHP Tutorial From beginner to master PHP is a powerful tool for making dynamic and interactive Web pages. PHP is the widely-used, free, and efficient alternative to competitors such as Microsoft's ASP.

More information

Database Administration with MySQL

Database Administration with MySQL Database Administration with MySQL Suitable For: Database administrators and system administrators who need to manage MySQL based services. Prerequisites: Practical knowledge of SQL Some knowledge of relational

More information

Toad for Data Analysts, Tips n Tricks

Toad for Data Analysts, Tips n Tricks Toad for Data Analysts, Tips n Tricks or Things Everyone Should Know about TDA Just what is Toad for Data Analysts? Toad is a brand at Quest. We have several tools that have been built explicitly for developers

More information

Accessing Your Database with JMP 10 JMP Discovery Conference 2012 Brian Corcoran SAS Institute

Accessing Your Database with JMP 10 JMP Discovery Conference 2012 Brian Corcoran SAS Institute Accessing Your Database with JMP 10 JMP Discovery Conference 2012 Brian Corcoran SAS Institute JMP provides a variety of mechanisms for interfacing to other products and getting data into JMP. The connection

More information

Thoroughbred Basic TM ODBC Client Capability Customization Supplement

Thoroughbred Basic TM ODBC Client Capability Customization Supplement Thoroughbred Basic TM ODBC Client Capability Customization Supplement Version 8.8.0 46 Vreeland Drive, Suite 1 Skillman, NJ 08558-2638 Telephone: 732-560-1377 Outside NJ 800-524-0430 Fax: 732-560-1594

More information

FileMaker Server 12. FileMaker Server Help

FileMaker Server 12. FileMaker Server Help FileMaker Server 12 FileMaker Server Help 2010-2012 FileMaker, Inc. All Rights Reserved. FileMaker, Inc. 5201 Patrick Henry Drive Santa Clara, California 95054 FileMaker is a trademark of FileMaker, Inc.

More information

LAMP Quickstart for Red Hat Enterprise Linux 4

LAMP Quickstart for Red Hat Enterprise Linux 4 LAMP Quickstart for Red Hat Enterprise Linux 4 Dave Jaffe Dell Enterprise Marketing December 2005 Introduction A very common way to build web applications with a database backend is called a LAMP Stack,

More information

APACHE WEB SERVER. Andri Mirzal, PhD N28-439-03

APACHE WEB SERVER. Andri Mirzal, PhD N28-439-03 APACHE WEB SERVER Andri Mirzal, PhD N28-439-03 Introduction The Apache is an open source web server software program notable for playing a key role in the initial growth of the World Wide Web Typically

More information

Access Control System Database and Linux Administration. V 1.00 5/8/2010 Ben Davis

Access Control System Database and Linux Administration. V 1.00 5/8/2010 Ben Davis Access Control System Database and Linux Administration V 1.00 5/8/2010 Ben Davis MySQL Database Administration The MySQL database is the heart of the Access Control System. It holds all the users, settings,

More information

Business Intelligence Tutorial

Business Intelligence Tutorial IBM DB2 Universal Database Business Intelligence Tutorial Version 7 IBM DB2 Universal Database Business Intelligence Tutorial Version 7 Before using this information and the product it supports, be sure

More information

for Networks Installation Guide for the application on the server August 2014 (GUIDE 2) Lucid Exact Version 1.7-N and later

for Networks Installation Guide for the application on the server August 2014 (GUIDE 2) Lucid Exact Version 1.7-N and later for Networks Installation Guide for the application on the server August 2014 (GUIDE 2) Lucid Exact Version 1.7-N and later Copyright 2014, Lucid Innovations Limited. All Rights Reserved Lucid Research

More information

StoreGrid Backup Server With MySQL As Backend Database:

StoreGrid Backup Server With MySQL As Backend Database: StoreGrid Backup Server With MySQL As Backend Database: Installing and Configuring MySQL on Windows Overview StoreGrid now supports MySQL as a backend database to store all the clients' backup metadata

More information

Customer Bank Account Management System Technical Specification Document

Customer Bank Account Management System Technical Specification Document Customer Bank Account Management System Technical Specification Document Technical Specification Document Page 1 of 15 Table of Contents Contents 1 Introduction 3 2 Design Overview 4 3 Topology Diagram.6

More information

ISI ACADEMY Web applications Programming Diploma using PHP& MySQL

ISI ACADEMY Web applications Programming Diploma using PHP& MySQL ISI ACADEMY for PHP& MySQL web applications Programming ISI ACADEMY Web applications Programming Diploma using PHP& MySQL HTML - CSS - JavaScript PHP - MYSQL What You'll Learn Be able to write, deploy,

More information

NGASI AppServer Manager SaaS/ASP Hosting Automation for Cloud Computing Administrator and User Guide

NGASI AppServer Manager SaaS/ASP Hosting Automation for Cloud Computing Administrator and User Guide NGASI AppServer Manager SaaS/ASP Hosting Automation for Cloud Computing Administrator and User Guide NGASI SaaS Hosting Automation is a JAVA SaaS Enablement infrastructure that enables web hosting services

More information

Software Requirement Specification For Flea Market System

Software Requirement Specification For Flea Market System Software Requirement Specification For Flea Market System By Ilya Verlinsky, Alexander Sarkisyan, Ambartsum Keshishyan, Igor Gleyser, Andrey Ishuninov 1 INTRODUCTION 1.1 Purpose 1.1.1 Purpose of SRS document

More information

for Networks Installation Guide for the application on the server July 2014 (GUIDE 2) Lucid Rapid Version 6.05-N and later

for Networks Installation Guide for the application on the server July 2014 (GUIDE 2) Lucid Rapid Version 6.05-N and later for Networks Installation Guide for the application on the server July 2014 (GUIDE 2) Lucid Rapid Version 6.05-N and later Copyright 2014, Lucid Innovations Limited. All Rights Reserved Lucid Research

More information

Mercury Users Guide Version 1.3 February 14, 2006

Mercury Users Guide Version 1.3 February 14, 2006 Mercury Users Guide Version 1.3 February 14, 2006 1 Introduction Introducing Mercury Your corporate shipping has just become easier! The satisfaction of your customers depends on the accuracy of your shipments,

More information

SQL Server An Overview

SQL Server An Overview SQL Server An Overview SQL Server Microsoft SQL Server is designed to work effectively in a number of environments: As a two-tier or multi-tier client/server database system As a desktop database system

More information

Tivoli Endpoint Manager BigFix Dashboard

Tivoli Endpoint Manager BigFix Dashboard Tivoli Endpoint Manager BigFix Dashboard Helping you monitor and control your Deployment. By Daniel Heth Moran Version 1.1.0 http://bigfix.me/dashboard 1 Copyright Stuff This edition first published in

More information