Connecting Your Authorware Piece to a Database An Absolute Beginner’s Guide to Database Concepts
Who I am (Amy Blankenship) Started as graphic designer Authorware user since 1996 Member of Team Macromedia Now a freelance contractor Recently married Steve Howard
Who You Are Someone who is just starting out with databases Someone who has used databases, but would like clarification on some parts of the process Someone who has used databases locally, but who would like to move toward web delivery
What we’ll cover Reasons to use a database Things to consider before using a database Choosing a database Designing a Database How database connections work Connecting locally Connecting over the web
What we won’t cover Complicated code examples Specific functionality This presentation is designed to take the mystery out of the process of creating and connecting to databases—there are plenty of online examples of exactly how to do it once you understand it!
Ask Questions! Your questions make my presentation better I am always sympathetic to any question, even if you think it might be stupid
What is a Database? A database is a set of information that has a usable structure Most databases fall into one of two types Flat: Everything is in a table where all members of a given column are assumed to be similar values, and the members of a row are assumed to be related to each other Some relationships are possible by using pointers to other tables Example: Spreadsheets, FileMaker Pro Relational: One or more tables containing rows where each row is a record, and the columns define the type of data Relationships can be and usually are defined and enforced by the database software Example: Microsoft Access and SQL Server, Oracle
Reasons to use a Database Separation of code and content You can (relatively) easily change the content without changing the code You can (relatively) easily change appearance and major functionality without redoing the content In theory, you can have people who know nothing about coding creating content (create an engine that can run content solely based on the database) You can use the same content in other places Centralized Record Keeping User tracking and reporting Other statistics Looks good to Technophiles
Questions to ask What kind of data do I need to store? Who needs to see the data and what use will be made of it? Where will the data come from, and how will it get into the database? Will it be a centralized database, or will a database file be installed on each computer? What kinds of user environment can I expect? What kind of server environment can I expect? Windows vs UNIX Your own servers vs. hosted
Choosing a Database
Designing a Database Before starting your design, consider how your data will be used! Avoid repeating data (normalize your data) Note that properly normalized data will result in more complex table structure and queries, but better data integrity and more flexibility Define the relationships in the database so that the database tools will work for you
Database Design: Start from the end result you want
Database Communication Two main protocols: ODBC—Open DataBase Connectivity Mandatory to use this if you’re using a DSN OLE DB—Object Linking and Embedding for Databases Can be used to make remote connections without backend technology Both protocols are a set of drivers that are installed on the computer that needs to make a direct connection to the database You make a connection to the database with a connection string
DSN (DataSource name) A DSN is a setting on a computer that contains the location of the database, the password, the driver to use, etc.—all the information that computer will need to connect to the database A DSN must be set up on each computer that needs to connect to the database A DSN must be set up under an account on that computer that has administrator rights
When to use a DSN If you’re connecting to a database that is on the same computer or physically available to it and you are using ODBC.u32 from Authorware 6.5 or lower, you have to use a DSN If you’re delivering to the web and using back-end pages, you may choose to use a DSN (on the pages, not in Authorware) If you’re connecting to a local database and you’re using ODBC.u32 from Authorware 7, avoid using a DSN
How to create a DSN Manually—use the Data Sources Control Panel Requires Admin rights Dynamically—Using TMSdsn from the MediaShoppe (no longer in business, but the u32 is still delivered on the Authorware CD) Requires Admin rights IT Department can push the DSN
DSN Alternatives Provide all of the data contained in the DSN yourself (DSN’less connection) Physical path or server address to the database Password Driver Etc. Connection Strings Reference: http:// www.carlprothman.net/Default.aspx?tabid =81 Back end pages (web hosted databases only) Still uses a DSN or DSN’less connection, but the connection is done by the page
Communicating with Databases SQL: Structured Query Language Get a good reference Make use of the in-built query builders, if present SQL can be stored In your Authorware application (technically easier) In a back-end page (more secure) In the database itself (secure and flexible) Oldie but goodie SQL Reference: http:// msdn.microsoft.com/archive/default.asp?url =/archive/en-us/office97/html/output/F1/D2/S5A318.asp
Communicating locally Open a Connection With a DSN Make sure the DSN exists Use ODBC.u32’s ODBCOpen() with a DSN connection string to open the connection Without a DSN Use ODBCOpenDynamic() with a DSN’less connection string to open a dynamic connection Use ODBCExecute() to run your SQL command(s) Close the connection immediately Saves bandwidth Maximizes your connections Improves server performance For an example of the code, see the ODBC ShowMe Note that you can also use third party products to perform local connections, but most of these solutions have limitations that make them impractical (in my opinion)
Communicating over the web ODBC connections over the web are possible, but not advisable Back-end pages (disadvantage is someone has to write the pages) ASP—primarily Windows PHP—primarily UNIX CGI—mostly UNIX Etc. For an example, see http://www.authorware-amy.com/examples.htm Your first Database ( Webmonkey ) for an example of how to connect ASP to a database Third party solutions INM’s GoldenGate Simple to set up and use, can create property lists direct from the query DataGrip web xmySQL
Thank You! Enjoy the rest of the conference

Database Basics Taac 2005

  • 1.
    Connecting Your AuthorwarePiece to a Database An Absolute Beginner’s Guide to Database Concepts
  • 2.
    Who I am(Amy Blankenship) Started as graphic designer Authorware user since 1996 Member of Team Macromedia Now a freelance contractor Recently married Steve Howard
  • 3.
    Who You AreSomeone who is just starting out with databases Someone who has used databases, but would like clarification on some parts of the process Someone who has used databases locally, but who would like to move toward web delivery
  • 4.
    What we’ll coverReasons to use a database Things to consider before using a database Choosing a database Designing a Database How database connections work Connecting locally Connecting over the web
  • 5.
    What we won’tcover Complicated code examples Specific functionality This presentation is designed to take the mystery out of the process of creating and connecting to databases—there are plenty of online examples of exactly how to do it once you understand it!
  • 6.
    Ask Questions! Yourquestions make my presentation better I am always sympathetic to any question, even if you think it might be stupid
  • 7.
    What is aDatabase? A database is a set of information that has a usable structure Most databases fall into one of two types Flat: Everything is in a table where all members of a given column are assumed to be similar values, and the members of a row are assumed to be related to each other Some relationships are possible by using pointers to other tables Example: Spreadsheets, FileMaker Pro Relational: One or more tables containing rows where each row is a record, and the columns define the type of data Relationships can be and usually are defined and enforced by the database software Example: Microsoft Access and SQL Server, Oracle
  • 8.
    Reasons to usea Database Separation of code and content You can (relatively) easily change the content without changing the code You can (relatively) easily change appearance and major functionality without redoing the content In theory, you can have people who know nothing about coding creating content (create an engine that can run content solely based on the database) You can use the same content in other places Centralized Record Keeping User tracking and reporting Other statistics Looks good to Technophiles
  • 9.
    Questions to askWhat kind of data do I need to store? Who needs to see the data and what use will be made of it? Where will the data come from, and how will it get into the database? Will it be a centralized database, or will a database file be installed on each computer? What kinds of user environment can I expect? What kind of server environment can I expect? Windows vs UNIX Your own servers vs. hosted
  • 10.
  • 11.
    Designing a DatabaseBefore starting your design, consider how your data will be used! Avoid repeating data (normalize your data) Note that properly normalized data will result in more complex table structure and queries, but better data integrity and more flexibility Define the relationships in the database so that the database tools will work for you
  • 12.
    Database Design: Startfrom the end result you want
  • 13.
    Database Communication Twomain protocols: ODBC—Open DataBase Connectivity Mandatory to use this if you’re using a DSN OLE DB—Object Linking and Embedding for Databases Can be used to make remote connections without backend technology Both protocols are a set of drivers that are installed on the computer that needs to make a direct connection to the database You make a connection to the database with a connection string
  • 14.
    DSN (DataSource name)A DSN is a setting on a computer that contains the location of the database, the password, the driver to use, etc.—all the information that computer will need to connect to the database A DSN must be set up on each computer that needs to connect to the database A DSN must be set up under an account on that computer that has administrator rights
  • 15.
    When to usea DSN If you’re connecting to a database that is on the same computer or physically available to it and you are using ODBC.u32 from Authorware 6.5 or lower, you have to use a DSN If you’re delivering to the web and using back-end pages, you may choose to use a DSN (on the pages, not in Authorware) If you’re connecting to a local database and you’re using ODBC.u32 from Authorware 7, avoid using a DSN
  • 16.
    How to createa DSN Manually—use the Data Sources Control Panel Requires Admin rights Dynamically—Using TMSdsn from the MediaShoppe (no longer in business, but the u32 is still delivered on the Authorware CD) Requires Admin rights IT Department can push the DSN
  • 17.
    DSN Alternatives Provideall of the data contained in the DSN yourself (DSN’less connection) Physical path or server address to the database Password Driver Etc. Connection Strings Reference: http:// www.carlprothman.net/Default.aspx?tabid =81 Back end pages (web hosted databases only) Still uses a DSN or DSN’less connection, but the connection is done by the page
  • 18.
    Communicating with DatabasesSQL: Structured Query Language Get a good reference Make use of the in-built query builders, if present SQL can be stored In your Authorware application (technically easier) In a back-end page (more secure) In the database itself (secure and flexible) Oldie but goodie SQL Reference: http:// msdn.microsoft.com/archive/default.asp?url =/archive/en-us/office97/html/output/F1/D2/S5A318.asp
  • 19.
    Communicating locally Opena Connection With a DSN Make sure the DSN exists Use ODBC.u32’s ODBCOpen() with a DSN connection string to open the connection Without a DSN Use ODBCOpenDynamic() with a DSN’less connection string to open a dynamic connection Use ODBCExecute() to run your SQL command(s) Close the connection immediately Saves bandwidth Maximizes your connections Improves server performance For an example of the code, see the ODBC ShowMe Note that you can also use third party products to perform local connections, but most of these solutions have limitations that make them impractical (in my opinion)
  • 20.
    Communicating over theweb ODBC connections over the web are possible, but not advisable Back-end pages (disadvantage is someone has to write the pages) ASP—primarily Windows PHP—primarily UNIX CGI—mostly UNIX Etc. For an example, see http://www.authorware-amy.com/examples.htm Your first Database ( Webmonkey ) for an example of how to connect ASP to a database Third party solutions INM’s GoldenGate Simple to set up and use, can create property lists direct from the query DataGrip web xmySQL
  • 21.
    Thank You! Enjoythe rest of the conference