22 CHAPTER 30 Extending ColdFusion with CFX
NOTE
Before this listing will work, you need to create an ODBC data source called ows that points to the ows.mdb sample database. If
you are not using a Windows server, you can use other JDBC database drivers; just adjust the
DRIVER and CONNECT attributes
accordingly. The documentation for the driver should help you understand what values to provide for these attributes.
CAUTION
Be careful if you place pages such as this on a public Web server. This example won’t allow you to view the structure of any table that
is not in the
ows sample database, but code similar to this may make it possible for people to gain unwanted access to the structure
of your databases. The tag is not a security risk in and of itself, but you should use it carefully so that your users don’t see more than
you want them to see.
Listing 30.4 DatabaseMetaDataDemo.cfm—Using <CFX_DatabaseMetaData> in a ColdFusion Page
<!---
Filename: DatabaseMetaDataDemo.cfm
Author: Nate Weiss (NMW)
Purpose: Uses <CFX_DatabaseMetaData> to display
column names and data types
--->
<!--- The database table to display information about --->
<cfparam name=”FORM.TableName”
type=”string”
default=””>
Figure 30.5
This simple example
allows users to browse
through the database’s
structure.
Kommentare zu diesen Handbüchern