You may want your form to have
access to information in a database. For example, you may want to
retrieve data to populate a form based on a value, such as an employee
ID, that the user enters when filling the form. When the user enters
the ID number, it triggers a database lookup to retrieve the matching record
and display it in the form.
To display, insert, update, or delete data from a database, you
make a connection to the database and then bind the fields on the
form to the corresponding columns in the database table.
You can also use scripting to perform the Insert, Update, Delete,
and Next/Previous navigation of records in the database.
Determining when to use a database versus, for example, an XML
data file, is up to the application developer. You could have multiple
data connections configured for a form (one to a database, one to
an XML file) and bind individual fields to either of the data connections.
OLEDB is the only database connection that you can connect to
from Designer. Through the use of the Microsoft OLEDB Provider for
ODBC Drivers, you can also access databases identified by the ODBC
data source name (DSN). You can use OLE drivers other than the Microsoft
OLEDB Provider for ODBC, however the form must be certified in Acrobat
before it will function at run time.
In Acrobat, security concerns dictate that you cannot specify
an ODBC connection string by using the Driver=; syntax.
Therefore, the client computer needs a DSN configured for ODBC connections.
If you are
using external data sources in a form design that you want users
to fill in Adobe Reader, you must set usage rights for the form by
using Reader Extensions 10.
Do one of the following tasks:
Select
File > New Data Connection.
Select an object on the page. In the Object palette, click
the Binding tab, and select New Data Connection from the Data Binding
menu.
In the Name New Connection box, type a name for the connection.
The
name must be one word and no longer than 127 characters. The first character
of the name must be a letter or underscore (_). The remaining characters
may be letters, digits, hyphens (-), underscores, or periods (.).
Select OLEDB Database and click Next.
In the OLEDB dialog box, set up your database connection
string. If you need assistance with this setup, refer to your database
provider documentation.
Select one of these options then click Next:
Select the Table option and select a table as the record
source. The list is populated with a list of all the tables available
from the database identified by the connection string.
Select the Stored Procedure option and select the record
source from the list. The list is populated with all of the stored
procedures available from the database.
Select the SQL Query option and type the SQL query string.
Type your user name and password into the User and Password
boxes and set the appropriate ADO recordset options.
Click Next. Designer validates that the connection to the
database is successful and prompts you for credentials, if required.
Click Finish. The data appears in the Data View palette.