Matt Denko Writing Portfolio

AutoCAD dbConnect User's Guide Sample

Access External Databases

You can use AutoCAD® to associate, or link, data stored in external database programs such as dBASE®, Oracle®, and Microsoft® Access® with AutoCAD graphical objects. You can use all of the external database features without prior knowledge of databases or query languages. This section, however, does not cover in detail the theory of database design or the semantics of Structured Query Language (SQL).

Overview of Using AutoCAD with External Databases

When you link database records to graphical objects in a drawing, you can use powerful database queries to filter and sort information. You can present the results of a query graphically.

A database is a collection of logically related information, usually presented in a table format similar to a typical spreadsheet. The table below is an example of a simple database that might be used by a Facilities department to schedule maintenance work. It consists of four columns, or fields, labeled Maintenance task, Estimated hours, Frequency, and Assigned to. Individual fields, or cells, store data for a particular variable. Individual rows within the table are called records.

Maintenance Task Estimated Hours Frequency Assigned To
Elevator Servicing 3.5 Quarterly Ron Smith
Vacuum Carpets 5.25 Weekly Vicki Roberts
AC Check 2.00 Biweekly Amy Reed
Air Filter 3.00 Monthly Dat Tan

Most database systems are extremely flexible and can be easily modified. You can add new fields or remove existing ones from tables. Likewise, you can add or delete records from tables and edit existing records. With many databases you can also define relationships between multiple tables. For example, suppose you have two tables that share a common field, Room ID. Using a relational database, you can join these two tables using their common field. You don’t have to maintain and input duplicate data across multiple tables.

You can use AutoCAD to associate data contained in an external database table with AutoCAD graphical objects through the process of linking. Links are pointers to a database table that reference data from one or more records in that table. You can also use AutoCAD to attach labels that display data from selected table fields as text objects in your drawing.

The AutoCAD database connectivity feature provides the following:

  • An external configuration utility that enables AutoCAD to access the data contained in a particular database system
  • A dbConnect Manager where you can associate links, labels, and queries with AutoCAD drawings
  • A Data View window that displays records from a database table within an AutoCAD session
  • A Query Editor where you can construct, execute, and store SQL queries
  • A migration tool that converts links and displayable attributes to AutoCAD 2000 or later format from files created in earlier releases
  • A Link Select operation that creates iterative selection sets based on queries and graphical objects

Access a Database from within AutoCAD

When you have configured a data source, you can view and edit its records from within AutoCAD.

Configure a Database for Use with AutoCAD Drawings

Before you can access an external database from within AutoCAD, you must configure it using the Microsoft ODBC (Open Database Connectivity) and OLE DB programs. Using ODBC and OLE DB, AutoCAD can utilize data from other applications, regardless of the format that it’s stored in or the database platform that it’s created on. The configuration process involves creating a new data source that points to a collection of data and provides information about the drivers necessary to access it.

A data source may be either an individual table or a collection of tables stored in an environment, catalog, or schema. Environments, catalogs, and schemas are hierarchical database elements used by most database management systems that help you organize your data. They are in many ways analogous to a Windows-based directory structure: you can think of the environment as a folder that holds additional subdirectories of catalogs. Catalogs in turn contain additional subdirectories of schemas. Each schema is a collection of tables.

The configuration process varies slightly for different database systems. For example, server-based databases such as Oracle and Microsoft SQL Server™ require that you enter a valid user name and password and specify the network location where the database is located. File-based systems such as Microsoft Access and dBASE III do not require this information. Because of these variations, it is not possible to provide a generic configuration procedure that works for all databases. Individual procedures for configuring all the databases that AutoCAD supports are provided in the acad_dpg.hlp file in the AutoCAD Help system. You should also refer to the documentation for your particular database system and the Microsoft Help files for ODBC and OLE DB for additional information.

The connectivity feature supports the following external applications:

  • Microsoft Access 97
  • dBASE V and III
  • Microsoft Excel® 97
  • Oracle 8.0 and 7.3
  • Paradox 7.0
  • Microsoft Visual FoxPro® 6.0
  • SQL Server 7.0 and 6.5

AutoCAD 2002 includes several Microsoft Access sample database tables and a preconfigured direct driver (jet_dbsamples.udl) that you can use to work with these tables. You do not need to have Access installed in order to work with these files. If you accepted the default AutoCAD installation directory when installing AutoCAD, these files are located in c:\Program Files\AutoCAD 2002\Sample. If you moved the Sample folder to a different location, you must update the jet_dbsamples.udl configuration file before you can work with these tables.

The dbConnect Manager

The dbConnect Manager is a dockable, resizable window that contains a set of buttons and a tree view. In the dbConnect Manager, you can open the Data View window to view or edit a database table. You can also associate various database objects (such as link templates, label templates, and queries) with an AutoCAD drawing.