Step 4. What is a Data Source?

Step 4. What is a Data Source?

If you’re working with dynamic data for the first time, you may be wondering what the difference is between a “database,” a “data source,” and a “content source.” They’re not necessarily interchangeable, so a brief explanation will help.

Database: this file contains your data organized into one or more tables. Our sample is a Microsoft Access file (.mdb), but you may have chosen to work with Microsoft SQL Server (ASP), Oracle 8 (ASP), MySQL 3.23 (PHP and JSP), or Oracle 9 (JSP).

Data Source: this file points to a database and tells your site how to access it. You create a Data Source in the Dynamic Content area of the Site Settings. GoLive then places the Data Source file in the config > datasources folder of your Dynamic Site.

If your Microsoft Access database is not password-protected, as in this example, the database itself acts as the Data Source and you don’t have to create a separate one. You’re more likely to want to password-protect your database in a real life situation, so we’ll make a separate Data Source for it below.

Content Source: this is a query from your dynamic page to a database in order to provide content for that page. Pages can have multiple Content Sources that provide different content for that page. For instance, you’ll be creating Content Sources (queries) that return all records, or return only records with certain criteria, like only those records with a last name starting with “T”.

Adding a Content Source means you’re telling GoLive: “please look in table ‘x’ of database ‘y’, and pull out all records that match my filter requirements so I can have that data available as content for this page.” To add a Content Source, you just drag and drop a Content Source object from the Dynamic Content palette in the head section of a page.

Identify your Data Source

Now you need to tell GoLive what Data Source your site will use. If you have an Access database, you could just take your .mdb file and move it into the config > datasources folder, and you’d be done. If your .mdb file is password-protected, however, you’ll want to use the procedure that follows.

If you’re using a password protected Access database or MySQL, it’s not hard to create a Data Source. Just go to the Site menu and choose Settings > Dynamic Content. In the Data Sources area click New. Then choose the type of Data Source you’ll use (e.g. ADO Database, MySQL database, etc.). In the Data Source editor, give the Data Source a name first. The Data Source does not need to be given the same name as the database file itself, but it may be easier to name it the same way in order to avoid confusion. GoLive will add the proper file extension to the name you provide.

Next, give it the URL where the database exists on your Web server, and tell it the name of the database itself. You also need to tell it the username and password needed to access the database. That’s it! If you have any questions here, pages 382-385 of the GoLive 6.0 manual can answer them.